dnsserver

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Network addresses
	UDPAddr string // UDP listen address (e.g., ":53")
	TCPAddr string // TCP listen address (e.g., ":53")

	// Feature flags
	DisableUDP bool
	DisableTCP bool

	// Cookie settings
	CookieSecret []byte        // 16-byte secret for DNS cookies (auto-generated if nil)
	CookieTTL    time.Duration // Cookie validity period (default: 1 hour)

	// GeoIP settings
	GeoIPPath string // Path to MaxMind GeoIP database (optional)

	// Zone management
	Zones *zone.Manager

	// Timeouts
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	IdleTimeout  time.Duration
}

Config holds the DNS server configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a Config with sensible defaults.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for errors.

type Server

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

Server is a DNS server that handles queries, updates, and zone transfers.

func New

func New(cfg *Config) (*Server, error)

New creates a new DNS server with the given configuration.

func (*Server) ServeDNS

func (s *Server) ServeDNS(w dns.ResponseWriter, req *dns.Msg)

ServeDNS implements the dns.Handler interface.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully stops the DNS server.

func (*Server) Start

func (s *Server) Start() error

Start begins listening for DNS requests.

Jump to

Keyboard shortcuts

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