alias

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const TypeALIAS uint16 = 65280

Custom DNS record type for ALIAS records. Based on Private Use range on the link below. https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4

Variables

This section is empty.

Functions

This section is empty.

Types

type Alias

type Alias struct {
	Hdr dns.RR_Header
	*dns.CNAME
}

func (*Alias) Header

func (a *Alias) Header() *dns.RR_Header

Header returns the header of an resource record. The header contains everything up to the rdata.

func (*Alias) String

func (a *Alias) String() string

String returns the text representation of the resource record.

type Resolver added in v0.5.0

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver resolves ALIAS targets to A/AAAA records with caching.

func NewResolver added in v0.5.0

func NewResolver(cfg ResolverConfig) *Resolver

NewResolver creates a new ALIAS resolver.

func (*Resolver) Purge added in v0.5.0

func (r *Resolver) Purge()

Purge removes all entries from the cache.

func (*Resolver) PurgeTarget added in v0.5.0

func (r *Resolver) PurgeTarget(target string)

PurgeTarget removes cached entries for a specific target.

func (*Resolver) Resolve added in v0.5.0

func (r *Resolver) Resolve(ctx context.Context, target string, qtype uint16) ([]dns.RR, error)

Resolve resolves a target domain to A or AAAA records. Results are cached based on response TTL (bounded by min/max TTL). Only dns.TypeA and dns.TypeAAAA are supported.

type ResolverConfig added in v0.5.0

type ResolverConfig struct {
	// Upstream DNS servers to query. If empty, uses system resolvers.
	Upstreams []string

	// MinTTL is the minimum cache TTL. Responses with lower TTL will use this value.
	// Default: 30 seconds.
	MinTTL time.Duration

	// MaxTTL is the maximum cache TTL. Responses with higher TTL will be capped.
	// Default: 1 hour.
	MaxTTL time.Duration

	// Timeout for upstream DNS queries.
	// Default: 5 seconds.
	Timeout time.Duration
}

ResolverConfig configures the ALIAS resolver.

Jump to

Keyboard shortcuts

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