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 )

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

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.

hostnames_resolve_async( $ips )

This method uses a fully asynchronous and high-performance pure-perl stub resolver AnyEvent::DNS.

Given a reference to an array of hashes will resolve the IPv4 or IPv6 address in the ip or alias key of each hash into its hostname which will be inserted in the dns key of the hash.

Returns the supplied reference to an array of hashes with dns values for addresses which resolved.

no_resolve( $ip )

Given an IP address, returns true if excluded from DNS resolution by the dns_no configuration directive, otherwise returns false.