Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mamantoha committed Jul 1, 2024
1 parent b4640a6 commit a7aa64b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/resolv.cr
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ module Resolv
output = `netsh interface ip show dnsservers`

output.each_line do |line|
if match_result = (/Statically Configured DNS Servers\s*:\s*(\S+)/.match(line) || /DNS Servers\s*:\s*(\S+)/.match(line))
puts "Line: #{line}" # Debugging
match_result = /Statically Configured DNS Servers\s*:\s*(\S+)/.match(line)
if match_result
puts "Match: #{match_result[1]}" # Debugging
dns_servers << match_result[1]
else
match_result = /DNS Servers\s*:\s*(\S+)/.match(line)
if match_result
puts "Match: #{match_result[1]}" # Debugging
dns_servers << match_result[1]
end
end
end
{% else %}
Expand All @@ -30,9 +39,11 @@ module Resolv
end
{% end %}

dns_servers.first
dns_servers.first? || raise "No DNS servers found"
end

puts "Default DNS Resolver: #{default_dns_resolver}"

class DNS
# Default DNS Port
PORT = 53
Expand Down

0 comments on commit a7aa64b

Please sign in to comment.