Documentation ¶
Overview ¶
Package dnsutil contains DNS related helper functions.
Index ¶
- Constants
- func Dedup(m *dns.Msg) *dns.Msg
- func DuplicateCNAME(r *dns.CNAME, records []dns.RR) bool
- func ExtractAddressFromReverse(reverseName string) string
- func IsReverse(name string) int
- func Join(labels []string) string
- func ParseHostPort(s, defaultPort string) (string, error)
- func ParseHostPortOrFile(s ...string) ([]string, error)
- func TrimZone(q string, z string) (string, error)
Constants ¶
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 DuplicateCNAME ¶
DuplicateCNAME returns true if r already exists in records.
func ExtractAddressFromReverse ¶
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 ¶
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 Join ¶
Join joins labels to form a fully qualified domain name. If the last label is the root label it is ignored. Not other syntax checks are performed.
func ParseHostPort ¶
ParseHostPort will check if the host part is a valid IP address, if the IP address is valid, but no port is found, defaultPort is added.
func ParseHostPortOrFile ¶
ParseHostPortOrFile parses the strings in s, each string can either be a address, address:port or a filename. The address part is checked and the filename case a resolv.conf like file is parsed and the nameserver found are returned.
Types ¶
This section is empty.