module DNSCheck::Node

Public Instance Methods

hostname() click to toggle source
# File lib/dns-check/node.rb, line 20
def hostname
  DNSCheck.config[:hostname]
end
output() click to toggle source
# File lib/dns-check/node.rb, line 28
def output
  output ||= Output.new
end
resolv() click to toggle source
# File lib/dns-check/node.rb, line 16
def resolv
  DNSCheck
end
resolv_all() click to toggle source
# File lib/dns-check/node.rb, line 32
def resolv_all
  resolv.timeout = timeout

  EM.run do
    Fiber.new do
      @records.each do |e, ns, c|
        resolv.nameservers = ns

        resolved_ip = resolv.lookup(hostname)
        output_msg = [e, resolved_ip, ns.sample, c]
        output.insert do
          output.print_msg output_msg
        end
      end
      EM.stop
    end.resume
  end
end
start() click to toggle source
# File lib/dns-check/node.rb, line 11
def start
  @records = __init(DNSCheck.config)
  resolv_all
end
timeout() click to toggle source
# File lib/dns-check/node.rb, line 24
def timeout
  DNSCheck.config[:timeout]
end