dnsutil

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package dnsutil contains DNS related helper functions.

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."
)
View Source
const (
	// MinimalDefaultTTL is the absolute lowest TTL we use in CoreDNS.
	MinimalDefaultTTL = 5 * time.Second
	// MaximumDefaulTTL is the maximum TTL was use on RRsets in CoreDNS.
	// TODO: rename as MaximumDefaultTTL
	MaximumDefaulTTL = 1 * time.Hour
)

Variables

This section is empty.

Functions

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 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 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 MinimalTTL

func MinimalTTL(m *dns.Msg, mt response.Type) time.Duration

MinimalTTL scans the message returns the lowest TTL found taking into the response.Type of the message.

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