Package dnsutil copied from coredns project https://github.com/coredns/coredns/blob/master/plugin/pkg/dnsutil/reverse.go
const ( // IP4arpa is the reverse tree suffix for v4 IP addresses. IP4arpa = ".in-addr.arpa." // IP6arpa is the reverse tree suffix for v6 IP addresses. IP6arpa = ".ip6.arpa." )
ExtractAddressFromReverse turns a standard PTR reverse record name into an IP address. This works for ipv4 or ipv6.
220.127.116.11.in-addr.arpa. becomes 18.104.22.168. If the conversion fails the empty string is returned.
IsReverse returns 0 is name is not in a reverse zone. Anything > 0 indicates name is in a reverse zone. The returned integer will be 1 for in-addr.arpa. (IPv4) and 2 for ip6.arpa. (IPv6).