A set of helper subroutines to support parts of the Netdisco application.

There are no default exports, however the :all tag will export all subroutines.


hostname_from_ip( $ip, \%opts? )

Given an IP address (either IPv4 or IPv6), return the canonical hostname.

%opts can override the various timeouts available in Net::DNS::Resolver:

tcp_timeout: 120 (seconds)
udp_timeout: 30 (seconds)
retry: 4 (attempts)
retrans: 5 (timeout)

Returns undef if no PTR record exists for the IP.

ipv4_from_hostname( $name )

Given a host name will return the first IPv4 address.

Returns undef if no A record exists for the name.