Class: Netchk::DNSResolvVerifier
- Inherits:
-
Object
- Object
- Netchk::DNSResolvVerifier
- Defined in:
- lib/netchk/dns_resolv_verifier.rb
Instance Method Summary collapse
-
#initialize(**options) ⇒ DNSResolvVerifier
constructor
A new instance of DNSResolvVerifier.
- #verify ⇒ Object
Constructor Details
#initialize(**options) ⇒ DNSResolvVerifier
Returns a new instance of DNSResolvVerifier.
4 5 6 7 |
# File 'lib/netchk/dns_resolv_verifier.rb', line 4 def initialize(**) @domains = ['domains'] || %w[google.com youtube.com facebook.com] @resolv_conf = ['resolv.conf'] end |
Instance Method Details
#verify ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/netchk/dns_resolv_verifier.rb', line 9 def verify ::Resolv::DNS.open(@resolv_conf) do |dns| @domains.each do |domain| begin dns.getaddress(domain) rescue ::Resolv::ResolvError $stderr.puts "Failed to resolve #{domain}" end end end end |