Class: Netchk::DNSServerVerifier

Inherits:
Object
  • Object
show all
Defined in:
lib/netchk/dns_server_verifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ DNSServerVerifier

Returns a new instance of DNSServerVerifier.



8
9
10
# File 'lib/netchk/dns_server_verifier.rb', line 8

def initialize(**options)
  @resolve_conf = options['resolv.conf']
end

Instance Method Details

#verifyObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/netchk/dns_server_verifier.rb', line 12

def verify
  nameservers = self.nameservers
  if nameservers.empty?
    $stderr.puts 'No DNS server found. Verify your configuration.'
  else
    puts "Using DNS servers #{nameservers.map { |ns| ns.join('#') }.join(', ')}"
    nameservers.map do |ns|
      verify_nameserver(*ns)
    end
  end
end