From 00be14ac2cb658239c3f70a4c73bd8adbedb7f41 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 20 Nov 2012 10:19:59 +0000 Subject: Comment updates. --- lib/custodian/multiping.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/custodian/multiping.rb b/lib/custodian/multiping.rb index a39e81b..b498f13 100644 --- a/lib/custodian/multiping.rb +++ b/lib/custodian/multiping.rb @@ -4,6 +4,13 @@ require 'socket' require 'timeout' +# +# This class has methods to determine whether the target +# of a hostname/IP address is IPv4 or IPv6. +# +# Assuming the address resolves to one of those two types +# it can invoke on of /usr/bin/ping or /usr/bin/ping6 appropriately. +# class MultiPing # @@ -11,6 +18,9 @@ class MultiPing # attr_reader :hostname, :resolved + # + # Save the hostname away, resolve it if possible. + # def initialize( hostname ) @hostname = hostname @resolved = resolve_hostname( hostname ) @@ -18,14 +28,13 @@ class MultiPing # - # + # 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] @@ -96,6 +105,5 @@ class MultiPing return false end - end -- cgit v1.2.1