Class: Naminori::Service::Dns
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
event, event_ip, health_check, #initialize
Constructor Details
This class inherits a constructor from Naminori::Service::Base
Instance Method Details
#default_config ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/naminori/service/dns.rb', line 16 def default_config { role: "dns", port: "53", protocols: ["udp", "tcp"], vip: "192.168.77.9", method: "nat", query: "pepabo.com", retry: 3, timeout: 3 } end |
#healty?(ip) ⇒ Boolean
6 7 8 9 10 11 12 13 14 |
# File 'lib/naminori/service/dns.rb', line 6 def healty?(ip) dns = Resolv::DNS.new(:nameserver => ip ) dns.timeouts = config.timeout begin dns.getaddress(@config.query) rescue => e false end end |