dnsutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: Apache-2.0 Imports: 6 Imported by: 1,104

Documentation

Overview

Package dnsutil contains DNS related helper functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dedup

func Dedup(m *dns.Msg) *dns.Msg

Dedup de-duplicates a message.

func DuplicateCNAME

func DuplicateCNAME(r *dns.CNAME, records []dns.RR) bool

DuplicateCNAME returns true if r already exists in records.

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 Join

func Join(labels []string) string

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

func ParseHostPort(s, defaultPort string) (string, error)

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

func ParseHostPortOrFile(s ...string) ([]string, error)

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.

func TrimZone

func TrimZone(q string, z string) (string, error)

TrimZone removes the zone component from q. It returns the trimmed name or an error is zone is longer then qname. The trimmed name will be returned without a trailing dot.

Types

This section is empty.

Jump to

Keyboard shortcuts

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