dns

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Port is the port DNS listens on.
	Port = 53
)

Variables

This section is empty.

Functions

func DNS

func DNS(dns ...string) host.Configurator

DNS defines DNS servers.

func Service

func Service(configurators ...Configurator) host.Configurator

Service returns DNS service.

Types

type AliasConfig

type AliasConfig struct {
	Target  string
	QueryID uint64
}

AliasConfig stores configuration of CNAME alias.

type Config

type Config struct {
	DNSPort     uint16
	DKIMPort    uint16
	Zones       map[string]ZoneConfig
	ForwardTo   []net.IP
	ForwardFor  []net.IPNet
	EnableACME  bool
	EnableDKIM  bool
	WaveServers []string
}

Config stores dns configuration.

type Configurator

type Configurator func(c *Config)

Configurator defines function setting the dns configuration.

func ACME

func ACME() Configurator

ACME enables service required to authenticate ACME certificate requests.

func DKIM

func DKIM() Configurator

DKIM enables service required to create DKIM records.

func ForwardFor

func ForwardFor(networks ...string) Configurator

ForwardFor sets networks allowed to make forwarded DNS requests.

func ForwardTo

func ForwardTo(servers ...string) Configurator

ForwardTo sets DNS servers for forwarding.

func Waves

func Waves(waves ...string) Configurator

Waves adds wave servers to send challenge requests to.

func Zone

func Zone(domain, nameserver, email string, serialNumber uint32, configurators ...ZoneConfigurator) Configurator

Zone creates new DNS zone.

type ZoneConfig

type ZoneConfig struct {
	// Domain is the domain name configured by zone
	Domain string

	// SerialNumber is incremented whenever zone is changed
	SerialNumber uint32

	// MainNameserver is the address of the main DNS server
	MainNameserver string

	// Email is the mailer address of zone manager
	Email string

	// Nameservers is the list of nameservers for the zone
	Nameservers []string

	// Domains map domains to IP addresses
	Domains map[string][]net.IP

	// Aliases map one domain to another
	Aliases map[string]AliasConfig

	// MailExchanges specifies mail servers.
	MailExchanges map[string]uint16

	// Texts stores values of TXT records.
	Texts map[string][]string
}

ZoneConfig stores dns zone configuration.

type ZoneConfigurator

type ZoneConfigurator func(c *ZoneConfig)

ZoneConfigurator defines function setting the dns zone configuration.

func Alias

func Alias(from, to string) ZoneConfigurator

Alias adds CNAME record to the zone.

func Domain

func Domain(domain string, ips ...string) ZoneConfigurator

Domain adds A records to the zone.

func MailExchange

func MailExchange(domain string, priority uint16) ZoneConfigurator

MailExchange adds MX record to the zone.

func Nameservers

func Nameservers(nameservers ...string) ZoneConfigurator

Nameservers add nameservers to the zone.

func Text

func Text(domain string, values ...string) ZoneConfigurator

Text adds TXT record to the zone.

Directories

Path Synopsis
wire/generator command
wire/generator command

Jump to

Keyboard shortcuts

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