dnsutil

package
v0.0.0-...-5a4edd4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: AGPL-3.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dnsutil copied from coredns project https://github.com/coredns/coredns/blob/master/plugin/pkg/dnsutil/reverse.go

Index

Constants

View Source
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."
)

Variables

This section is empty.

Functions

func ExtractAddressFromReverse

func ExtractAddressFromReverse(reverseName string) string

ExtractAddressFromReverse turns a standard PTR reverse record name into an IP address. This works for ipv4 or ipv6.

54.119.58.176.in-addr.arpa. becomes 176.58.119.54. If the conversion fails the empty string is returned.

func IsReverse

func IsReverse(name string) int

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).

func Reverse

func Reverse(ip net.IP) (arpa string)

Reverse takes an IPv4 or IPv6 address and returns the matching ARPA record.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL