diff options
-rw-r--r-- | lib/custodian/multiping.rb | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/lib/custodian/multiping.rb b/lib/custodian/multiping.rb index b498f13..b800196 100644 --- a/lib/custodian/multiping.rb +++ b/lib/custodian/multiping.rb @@ -1,8 +1,6 @@ require 'getoptlong' -require 'socket' -require 'timeout' - +require 'custodian/dnsutil' # # This class has methods to determine whether the target @@ -23,34 +21,10 @@ class MultiPing # def initialize( hostname ) @hostname = hostname - @resolved = resolve_hostname( hostname ) - end - - - # - # TODO: Use custodian/dnsutil now it exists. - # - def resolve_hostname( hostname ) - res = nil - - begin - timeout( 4 ) do - begin - Socket.getaddrinfo(hostname, 'echo').each do |a| - res = a[3] - end - rescue SocketError - end - end - rescue Timeout::Error => e - resolved = nil - end - - res + @resolved = DNSUtil.hostname_to_ip( hostname ) end - # # Return the resolved address # |