config

package
v0.7.26 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACLConfig

type ACLConfig struct {
	Allow []string
	Deny  []string
	Zones []ACLZoneConfig
}

ACLConfig holds access control list settings.

type ACLZoneConfig

type ACLZoneConfig struct {
	Zone  string
	Allow []string
	Deny  []string
}

ACLZoneConfig holds per-zone ACL settings.

type BlocklistConfig

type BlocklistConfig struct {
	Enabled         bool
	Lists           []BlocklistEntry
	RefreshInterval time.Duration
	BlockingMode    string
	CustomIP        string
	Whitelist       []string
}

BlocklistConfig holds blocklist filtering settings.

type BlocklistEntry

type BlocklistEntry struct {
	URL    string
	Format string
}

BlocklistEntry holds a single blocklist source URL and its format.

type CacheConfig

type CacheConfig struct {
	MaxEntries    int
	MinTTL        uint32
	MaxTTL        uint32
	NegMaxTTL     uint32
	SweepInterval time.Duration
	ServeStale    bool
	StaleTTL      uint32
	// StaleMaxAge bounds how far past expiry a stale entry may be served
	// (RFC 8767 §3.3: "It is RECOMMENDED that responses no longer than
	// 1-3 days old be considered for stale serve"). An entry whose live
	// expiry is older than this threshold is rejected even when the
	// physical record is still in cache. Default is 86400 seconds (1 day).
	// Setting 0 keeps the prior unbounded behaviour for operators who
	// prefer it, but the strong recommendation is to keep a finite cap so
	// long-tail zones cannot pin obsolete data indefinitely.
	StaleMaxAge    uint32
	NoCacheClients []string
	Prefetch       bool
}

CacheConfig holds cache settings.

type ClusterActionConfig

type ClusterActionConfig struct {
	FanoutCacheFlush       bool
	FanoutBlocklistRefresh bool
}

ClusterActionConfig controls cluster fanout behavior for admin actions.

type ClusterConfig

type ClusterConfig struct {
	Enabled      bool
	Role         string
	NodeID       string
	SharedFields []string
	Peers        []ClusterPeerConfig
	Actions      ClusterActionConfig
	Sync         ClusterSyncConfig
}

ClusterConfig holds optional multi-node cluster settings.

type ClusterPeerConfig

type ClusterPeerConfig struct {
	Name       string
	Enabled    bool
	APIBase    string
	APIToken   string
	SyncFields []string
}

ClusterPeerConfig defines a peer node accessible via admin API.

type ClusterSyncConfig

type ClusterSyncConfig struct {
	Mode         string
	PushOnSave   bool
	PullInterval time.Duration
}

ClusterSyncConfig controls configuration synchronization behavior.

type Config

type Config struct {
	Server       ServerConfig
	Resolver     ResolverConfig
	Cache        CacheConfig
	Security     SecurityConfig
	Logging      LoggingConfig
	ACL          ACLConfig
	Web          WebConfig
	Daemon       DaemonConfig
	Zabbix       ZabbixConfig
	Blocklist    BlocklistConfig
	Cluster      ClusterConfig
	LocalZones   []LocalZoneConfig
	ForwardZones []ForwardZoneConfig
	StubZones    []StubZoneConfig
}

Config holds the complete application configuration.

func Load

func Load(path string) (*Config, error)

Load loads configuration from file, environment, and defaults.

func Parse

func Parse(data []byte) (*Config, error)

Parse builds a config from YAML bytes using defaults and validation. Environment variables are not applied in this helper.

type DaemonConfig

type DaemonConfig struct {
	Enabled bool
	PIDFile string
}

DaemonConfig holds daemon mode settings.

type ForwardZoneConfig

type ForwardZoneConfig struct {
	Name  string
	Addrs []string
}

ForwardZoneConfig holds a single forward zone: queries matching the zone name are forwarded (RD=1) to the configured upstream addresses.

type LocalZoneConfig

type LocalZoneConfig struct {
	Name string
	Type string
	Data []string
}

LocalZoneConfig holds a local zone's definition from the config file.

type LoggingConfig

type LoggingConfig struct {
	Level  string
	Format string
}

LoggingConfig holds logging settings.

type RRLConfig

type RRLConfig struct {
	Enabled            bool
	ResponsesPerSecond float64
	SlipRatio          int
	IPv4Prefix         int
	IPv6Prefix         int
}

RRLConfig holds response rate limiting settings.

type RateLimitConfig

type RateLimitConfig struct {
	Enabled bool
	Rate    float64
	Burst   int
}

RateLimitConfig holds rate limiter settings.

type ResolverConfig

type ResolverConfig struct {
	MaxDepth        int
	MaxCNAMEDepth   int
	UpstreamTimeout time.Duration
	UpstreamRetries int
	QMinEnabled     bool
	Caps0x20Enabled bool
	PreferIPv4      bool
	DNSSECEnabled   bool
	DNSSECAllowSHA1 bool
	// DNSSECNegativeTrustAnchors is the operator-installed NTA list
	// (RFC 7646). Each entry is "<zone>|<RFC3339 expiry>|<reason>" — the
	// pipe separator keeps the format trivially parseable from a YAML
	// list of strings without inventing a nested schema. Empty list
	// disables NTA enforcement.
	DNSSECNegativeTrustAnchors []string
	HardenBelowNXDomain        bool
	RootHintsRefresh           time.Duration
	ECSEnabled                 bool
	ECSMaxPrefix               int // IPv4 source-prefix ceiling (RFC 7871 §11.1 recommends /24)
	ECSMaxPrefixV6             int // IPv6 source-prefix ceiling (RFC 7871 §11.1 recommends /56)
	DNS64Enabled               bool
	DNS64Prefix                string
	FallbackResolvers          []string
	UpstreamUDPBufferSize      int
}

ResolverConfig holds resolver settings.

type SecurityConfig

type SecurityConfig struct {
	RateLimit            RateLimitConfig
	RRL                  RRLConfig
	PrivateAddressFilter bool
	DNSCookies           bool
	// DNSCookiesEnforce — RFC 7873 §5.4 strict mode. When true, a UDP
	// query without a client cookie is rejected with BADCOOKIE. Default
	// false; opt-in for hostile-network deployments. Has no effect
	// unless DNSCookies is also true.
	DNSCookiesEnforce bool
}

SecurityConfig holds security settings.

type ServerConfig

type ServerConfig struct {
	ListenAddr     string
	MetricsAddr    string
	MaxUDPSize     int
	TCPTimeout     time.Duration
	MaxTCPConns    int
	MaxUDPWorkers  int
	GracefulPeriod time.Duration
	TCPPipelineMax int
	TCPIdleTimeout time.Duration
	DoTEnabled     bool
	DoTListenAddr  string
	TLSCertFile    string
	TLSKeyFile     string
}

ServerConfig holds server-related settings.

type StubZoneConfig

type StubZoneConfig struct {
	Name  string
	Addrs []string
}

StubZoneConfig holds a single stub zone: the resolver starts iterative resolution (RD=0) from the configured nameserver addresses instead of roots.

type WebAuthConfig

type WebAuthConfig struct {
	Username     string
	PasswordHash string
}

WebAuthConfig holds web dashboard authentication settings.

type WebConfig

type WebConfig struct {
	Enabled             bool
	Addr                string
	QueryLogBuffer      int
	TopClientsLimit     int
	TopDomainsLimit     int
	AlertErrorThreshold float64
	AlertLatencyMs      int
	AutoUpdate          bool
	UpdateCheckInterval time.Duration
	Dashboard           WebDashboardConfig
	Auth                WebAuthConfig
	DoHEnabled          bool
	DoH3Enabled         bool
	TLSEnabled          bool
	TLSCertFile         string
	TLSKeyFile          string
	AutoTLS             bool
	AutoTLSDomain       string
	AutoTLSEmail        string
	AutoTLSCacheDir     string
	AutoTLSStaging      bool
}

WebConfig holds web dashboard settings.

type WebDashboardConfig

type WebDashboardConfig struct {
	PanelOrder   []string
	HiddenPanels []string
}

WebDashboardConfig holds persisted dashboard layout preferences.

type ZabbixConfig

type ZabbixConfig struct {
	Enabled bool
	Addr    string
}

ZabbixConfig holds Zabbix integration settings.

Jump to

Keyboard shortcuts

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