Documentation
¶
Index ¶
- Constants
- Variables
- func BytesSourceTypeNames() []string
- func ConvertPort(in string) (uint16, error)
- func IPVersionNames() []string
- func InitStrategyNames() []string
- func NetProtocolNames() []string
- func QueryLogFieldNames() []string
- func QueryLogTypeNames() []string
- func TLSVersionNames() []string
- func UpstreamStrategyNames() []string
- func WithDefaults[T any]() (T, error)
- type Blocking
- type BootstrapDNS
- type BootstrappedUpstream
- type BytesSource
- type BytesSourceType
- type Caching
- type CertificateFingerprint
- type ClientLookup
- type ConditionalUpstream
- type ConditionalUpstreamMapping
- type Config
- type Configurable
- type CustomDNS
- type CustomDNSEntries
- type CustomDNSMapping
- type DNSSEC
- type Downloader
- type Duration
- type ECS
- type ECSv4Mask
- type ECSv6Mask
- type EDE
- type FQDNOnly
- type Filtering
- type HostsFile
- type IPVersion
- func (x *IPVersion) AppendText(b []byte) ([]byte, error)
- func (x IPVersion) IsValid() bool
- func (x IPVersion) MarshalText() ([]byte, error)
- func (ipv IPVersion) Net() string
- func (ipv IPVersion) QTypes() []dns.Type
- func (x IPVersion) String() string
- func (x *IPVersion) UnmarshalText(text []byte) error
- type Init
- type InitStrategy
- func (x *InitStrategy) AppendText(b []byte) ([]byte, error)
- func (s InitStrategy) Do(ctx context.Context, init func(context.Context) error, logErr func(error)) error
- func (x InitStrategy) IsValid() bool
- func (x InitStrategy) MarshalText() ([]byte, error)
- func (x InitStrategy) String() string
- func (x *InitStrategy) UnmarshalText(text []byte) error
- type ListenConfig
- type Metrics
- type NetProtocol
- type Ports
- type QType
- type QTypeSet
- type QueryLog
- type QueryLogField
- type QueryLogIgnore
- type QueryLogType
- type Redis
- type RewriterConfig
- type SUDN
- type SourceLoading
- type TLSVersion
- type Upstream
- type UpstreamGroup
- type UpstreamGroups
- type UpstreamStrategy
- type Upstreams
- type ZoneFileDNS
Constants ¶
const UpstreamDefaultCfgName = "default"
Variables ¶
var ErrInvalidBytesSourceType = fmt.Errorf("not a valid BytesSourceType, try [%s]", strings.Join(_BytesSourceTypeNames, ", "))
var ErrInvalidIPVersion = fmt.Errorf("not a valid IPVersion, try [%s]", strings.Join(_IPVersionNames, ", "))
var ErrInvalidInitStrategy = fmt.Errorf("not a valid InitStrategy, try [%s]", strings.Join(_InitStrategyNames, ", "))
var ErrInvalidNetProtocol = fmt.Errorf("not a valid NetProtocol, try [%s]", strings.Join(_NetProtocolNames, ", "))
var ErrInvalidQueryLogField = fmt.Errorf("not a valid QueryLogField, try [%s]", strings.Join(_QueryLogFieldNames, ", "))
var ErrInvalidQueryLogType = fmt.Errorf("not a valid QueryLogType, try [%s]", strings.Join(_QueryLogTypeNames, ", "))
var ErrInvalidTLSVersion = fmt.Errorf("not a valid TLSVersion, try [%s]", strings.Join(_TLSVersionNames, ", "))
var ErrInvalidUpstreamStrategy = fmt.Errorf("not a valid UpstreamStrategy, try [%s]", strings.Join(_UpstreamStrategyNames, ", "))
Functions ¶
func BytesSourceTypeNames ¶
func BytesSourceTypeNames() []string
BytesSourceTypeNames returns a list of possible string values of BytesSourceType.
func ConvertPort ¶
ConvertPort converts string representation into a valid port (0 - 65535)
func IPVersionNames ¶
func IPVersionNames() []string
IPVersionNames returns a list of possible string values of IPVersion.
func InitStrategyNames ¶
func InitStrategyNames() []string
InitStrategyNames returns a list of possible string values of InitStrategy.
func NetProtocolNames ¶
func NetProtocolNames() []string
NetProtocolNames returns a list of possible string values of NetProtocol.
func QueryLogFieldNames ¶
func QueryLogFieldNames() []string
QueryLogFieldNames returns a list of possible string values of QueryLogField.
func QueryLogTypeNames ¶
func QueryLogTypeNames() []string
QueryLogTypeNames returns a list of possible string values of QueryLogType.
func TLSVersionNames ¶
func TLSVersionNames() []string
TLSVersionNames returns a list of possible string values of TLSVersion.
func UpstreamStrategyNames ¶
func UpstreamStrategyNames() []string
UpstreamStrategyNames returns a list of possible string values of UpstreamStrategy.
func WithDefaults ¶
Types ¶
type Blocking ¶
type Blocking struct {
Denylists map[string][]BytesSource `yaml:"denylists"`
Allowlists map[string][]BytesSource `yaml:"allowlists"`
ClientGroupsBlock map[string][]string `yaml:"clientGroupsBlock"`
BlockType string `default:"ZEROIP" yaml:"blockType"`
BlockTTL Duration `default:"6h" yaml:"blockTTL"`
Loading SourceLoading `yaml:"loading"`
// Deprecated options
Deprecated struct {
BlackLists *map[string][]BytesSource `yaml:"blackLists"`
WhiteLists *map[string][]BytesSource `yaml:"whiteLists"`
DownloadTimeout *Duration `yaml:"downloadTimeout"`
DownloadAttempts *uint `yaml:"downloadAttempts"`
DownloadCooldown *Duration `yaml:"downloadCooldown"`
RefreshPeriod *Duration `yaml:"refreshPeriod"`
FailStartOnListError *bool `yaml:"failStartOnListError"`
ProcessingConcurrency *uint `yaml:"processingConcurrency"`
StartStrategy *InitStrategy `yaml:"startStrategy"`
MaxErrorsPerFile *int `yaml:"maxErrorsPerFile"`
} `yaml:",inline"`
}
Blocking configuration for query blocking
type BootstrapDNS ¶
type BootstrapDNS bootstrapDNS
split in two types to avoid infinite recursion. See `BootstrapDNS.UnmarshalYAML`.
func (*BootstrapDNS) IsEnabled ¶
func (b *BootstrapDNS) IsEnabled() bool
func (*BootstrapDNS) LogConfig ¶
func (b *BootstrapDNS) LogConfig(*logrus.Entry)
func (*BootstrapDNS) UnmarshalYAML ¶
func (b *BootstrapDNS) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML creates BootstrapDNS from YAML
type BootstrappedUpstream ¶
type BootstrappedUpstream bootstrappedUpstream
split in two types to avoid infinite recursion. See `BootstrappedUpstream.UnmarshalYAML`.
func (*BootstrappedUpstream) UnmarshalYAML ¶
func (b *BootstrappedUpstream) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML creates BootstrappedUpstream from YAML
type BytesSource ¶
type BytesSource struct {
Type BytesSourceType
From string
}
func NewBytesSources ¶
func NewBytesSources(sources ...string) []BytesSource
func TextBytesSource ¶
func TextBytesSource(lines ...string) BytesSource
func (BytesSource) String ¶
func (s BytesSource) String() string
func (*BytesSource) UnmarshalText ¶
func (s *BytesSource) UnmarshalText(data []byte) error
UnmarshalText implements `encoding.TextUnmarshaler`.
type BytesSourceType ¶
type BytesSourceType uint16
BytesSourceType supported BytesSource types. ENUM( text=1 // Inline YAML block. http // HTTP(S). file // Local file. )
const ( // BytesSourceTypeText is a BytesSourceType of type Text. // Inline YAML block. BytesSourceTypeText BytesSourceType = iota + 1 // BytesSourceTypeHttp is a BytesSourceType of type Http. // HTTP(S). BytesSourceTypeHttp // BytesSourceTypeFile is a BytesSourceType of type File. // Local file. BytesSourceTypeFile )
func BytesSourceTypeValues ¶
func BytesSourceTypeValues() []BytesSourceType
BytesSourceTypeValues returns a list of the values for BytesSourceType
func ParseBytesSourceType ¶
func ParseBytesSourceType(name string) (BytesSourceType, error)
ParseBytesSourceType attempts to convert a string to a BytesSourceType.
func (*BytesSourceType) AppendText ¶ added in v0.28.0
func (x *BytesSourceType) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (BytesSourceType) IsValid ¶
func (x BytesSourceType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (BytesSourceType) MarshalText ¶
func (x BytesSourceType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (BytesSourceType) String ¶
func (x BytesSourceType) String() string
String implements the Stringer interface.
func (*BytesSourceType) UnmarshalText ¶
func (x *BytesSourceType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Caching ¶
type Caching struct {
MinCachingTime Duration `yaml:"minTime"`
MaxCachingTime Duration `yaml:"maxTime"`
CacheTimeNegative Duration `default:"30m" yaml:"cacheTimeNegative"`
MaxItemsCount int `yaml:"maxItemsCount"`
Prefetching bool `yaml:"prefetching"`
PrefetchExpires Duration `default:"2h" yaml:"prefetchExpires"`
PrefetchThreshold int `default:"5" yaml:"prefetchThreshold"`
PrefetchMaxItemsCount int `yaml:"prefetchMaxItemsCount"`
Exclude []string `yaml:"exclude"`
}
Caching configuration for domain caching
func (*Caching) EnablePrefetch ¶
func (c *Caching) EnablePrefetch()
type CertificateFingerprint ¶ added in v0.28.0
type CertificateFingerprint []byte
CertificateFingerprint represents a SHA256 fingerprint of a TLS certificate (32 bytes)
type ClientLookup ¶
type ClientLookup struct {
ClientnameIPMapping map[string][]net.IP `yaml:"clients"`
Upstream Upstream `yaml:"upstream"`
SingleNameOrder []uint `yaml:"singleNameOrder"`
}
ClientLookup configuration for the client lookup
func (*ClientLookup) IsEnabled ¶
func (c *ClientLookup) IsEnabled() bool
IsEnabled implements `config.Configurable`.
func (*ClientLookup) LogConfig ¶
func (c *ClientLookup) LogConfig(logger *logrus.Entry)
LogConfig implements `config.Configurable`.
type ConditionalUpstream ¶
type ConditionalUpstream struct {
RewriterConfig `yaml:",inline"`
Mapping ConditionalUpstreamMapping `yaml:"mapping"`
}
ConditionalUpstream conditional upstream configuration
func (*ConditionalUpstream) IsEnabled ¶
func (c *ConditionalUpstream) IsEnabled() bool
IsEnabled implements `config.Configurable`.
func (*ConditionalUpstream) LogConfig ¶
func (c *ConditionalUpstream) LogConfig(logger *logrus.Entry)
LogConfig implements `config.Configurable`.
type ConditionalUpstreamMapping ¶
ConditionalUpstreamMapping mapping for conditional configuration
func (*ConditionalUpstreamMapping) UnmarshalYAML ¶
func (c *ConditionalUpstreamMapping) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements `yaml.Unmarshaler`.
type Config ¶
type Config struct {
Upstreams Upstreams `yaml:"upstreams"`
ConnectIPVersion IPVersion `yaml:"connectIPVersion"`
CustomDNS CustomDNS `yaml:"customDNS"`
Conditional ConditionalUpstream `yaml:"conditional"`
Blocking Blocking `yaml:"blocking"`
ClientLookup ClientLookup `yaml:"clientLookup"`
Caching Caching `yaml:"caching"`
QueryLog QueryLog `yaml:"queryLog"`
Prometheus Metrics `yaml:"prometheus"`
Redis Redis `yaml:"redis"`
Log log.Config `yaml:"log"`
Ports Ports `yaml:"ports"`
MinTLSServeVer TLSVersion `default:"1.2" yaml:"minTlsServeVersion"`
CertFile string `yaml:"certFile"`
KeyFile string `yaml:"keyFile"`
BootstrapDNS BootstrapDNS `yaml:"bootstrapDns"`
HostsFile HostsFile `yaml:"hostsFile"`
FQDNOnly FQDNOnly `yaml:"fqdnOnly"`
Filtering Filtering `yaml:"filtering"`
EDE EDE `yaml:"ede"`
ECS ECS `yaml:"ecs"`
SUDN SUDN `yaml:"specialUseDomains"`
DNSSEC DNSSEC `yaml:"dnssec"`
// Deprecated options
Deprecated struct {
Upstream *UpstreamGroups `yaml:"upstream"`
UpstreamTimeout *Duration `yaml:"upstreamTimeout"`
DisableIPv6 *bool `yaml:"disableIPv6"`
LogLevel *logrus.Level `yaml:"logLevel"`
LogFormat *log.FormatType `yaml:"logFormat"`
LogPrivacy *bool `yaml:"logPrivacy"`
LogTimestamp *bool `yaml:"logTimestamp"`
DNSPorts *ListenConfig `yaml:"port"`
HTTPPorts *ListenConfig `yaml:"httpPort"`
HTTPSPorts *ListenConfig `yaml:"httpsPort"`
TLSPorts *ListenConfig `yaml:"tlsPort"`
StartVerifyUpstream *bool `yaml:"startVerifyUpstream"`
DoHUserAgent *string `yaml:"dohUserAgent"`
} `yaml:",inline"`
}
Config main configuration
type Configurable ¶
type CustomDNS ¶
type CustomDNS struct {
RewriterConfig `yaml:",inline"`
CustomTTL Duration `default:"1h" yaml:"customTTL"`
Mapping CustomDNSMapping `yaml:"mapping"`
Zone ZoneFileDNS `default:"" yaml:"zone"`
FilterUnmappedTypes bool `default:"true" yaml:"filterUnmappedTypes"`
}
CustomDNS custom DNS configuration
type CustomDNSEntries ¶
func (*CustomDNSEntries) UnmarshalYAML ¶
func (c *CustomDNSEntries) UnmarshalYAML(unmarshal func(interface{}) error) error
type CustomDNSMapping ¶
type CustomDNSMapping map[string]CustomDNSEntries
type DNSSEC ¶ added in v0.28.0
type DNSSEC struct {
Validate bool `default:"false" yaml:"validate"`
TrustAnchors []string `yaml:"trustAnchors"`
MaxChainDepth uint `default:"10" yaml:"maxChainDepth"`
CacheExpirationHours uint `default:"1" yaml:"cacheExpirationHours"`
MaxNSEC3Iterations uint `default:"150" yaml:"maxNSEC3Iterations"` // RFC 5155 §10.3
// DoS protection: max upstream queries per validation
MaxUpstreamQueries uint `default:"30" yaml:"maxUpstreamQueries"`
// Clock skew tolerance in seconds for signature validation (default: 3600 = 1 hour)
// Allows validation to succeed even if system clock is off by this amount.
// Matches Unbound/BIND defaults for real-world deployments (VMs, containers, embedded systems).
// Per RFC 6781 §4.1.2: Validators should account for clock skew in deployment environments.
ClockSkewToleranceSec uint `default:"3600" yaml:"clockSkewToleranceSec"`
}
DNSSEC is the configuration for DNSSEC validation
type Downloader ¶
type Downloader struct {
Timeout Duration `default:"5s" yaml:"timeout"`
ReadTimeout Duration `default:"20s" yaml:"readTimeout"`
ReadHeaderTimeout Duration `default:"20s" yaml:"readHeaderTimeout"`
WriteTimeout Duration `default:"20s" yaml:"writeTimeout"`
Attempts uint `default:"3" yaml:"attempts"`
Cooldown Duration `default:"500ms" yaml:"cooldown"`
}
func (*Downloader) LogConfig ¶
func (c *Downloader) LogConfig(logger *logrus.Entry)
type Duration ¶
Duration is a wrapper for time.Duration to support yaml unmarshalling
func (Duration) IsAboveZero ¶
IsAboveZero returns true if duration is strictly greater than zero.
func (Duration) IsAtLeastZero ¶
IsAtLeastZero returns true if duration is greater or equal to zero.
func (Duration) SecondsU32 ¶
SecondsU32 returns duration in seconds as uint32
func (Duration) ToDuration ¶
ToDuration converts Duration to time.Duration
func (*Duration) UnmarshalText ¶
UnmarshalText implements `encoding.TextUnmarshaler`.
type ECS ¶
type ECS struct {
UseAsClient bool `default:"false" yaml:"useAsClient"`
Forward bool `default:"false" yaml:"forward"`
IPv4Mask ECSv4Mask `default:"0" yaml:"ipv4Mask"`
IPv6Mask ECSv6Mask `default:"0" yaml:"ipv6Mask"`
}
ECS is the configuration of the ECS resolver
type ECSv4Mask ¶
type ECSv4Mask uint8
ECSv4Mask is the subnet mask to be added as EDNS0 option for IPv4
func (*ECSv4Mask) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface
type ECSv6Mask ¶
type ECSv6Mask uint8
ECSv6Mask is the subnet mask to be added as EDNS0 option for IPv6
func (*ECSv6Mask) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface
type Filtering ¶
type Filtering struct {
QueryTypes QTypeSet `yaml:"queryTypes"`
}
type HostsFile ¶
type HostsFile struct {
Sources []BytesSource `yaml:"sources"`
HostsTTL Duration `default:"1h" yaml:"hostsTTL"`
FilterLoopback bool `yaml:"filterLoopback"`
Loading SourceLoading `yaml:"loading"`
// Deprecated options
Deprecated struct {
RefreshPeriod *Duration `yaml:"refreshPeriod"`
Filepath *BytesSource `yaml:"filePath"`
} `yaml:",inline"`
}
type IPVersion ¶
type IPVersion uint8
IPVersion represents IP protocol version(s). ENUM( dual // IPv4 and IPv6 v4 // IPv4 only v6 // IPv6 only )
func IPVersionValues ¶
func IPVersionValues() []IPVersion
IPVersionValues returns a list of the values for IPVersion
func ParseIPVersion ¶
ParseIPVersion attempts to convert a string to a IPVersion.
func (*IPVersion) AppendText ¶ added in v0.28.0
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (IPVersion) IsValid ¶
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (IPVersion) MarshalText ¶
MarshalText implements the text marshaller method.
func (*IPVersion) UnmarshalText ¶
UnmarshalText implements the text unmarshaller method.
type Init ¶
type Init struct {
Strategy InitStrategy `default:"blocking" yaml:"strategy"`
}
type InitStrategy ¶
type InitStrategy uint16
InitStrategy startup strategy ENUM( blocking // synchronously download blocking lists on startup failOnError // synchronously download blocking lists on startup and shutdown on error fast // asyncronously download blocking lists on startup )
const ( // InitStrategyBlocking is a InitStrategy of type Blocking. // synchronously download blocking lists on startup InitStrategyBlocking InitStrategy = iota // InitStrategyFailOnError is a InitStrategy of type FailOnError. // synchronously download blocking lists on startup and shutdown on error InitStrategyFailOnError // InitStrategyFast is a InitStrategy of type Fast. // asyncronously download blocking lists on startup InitStrategyFast )
func InitStrategyValues ¶
func InitStrategyValues() []InitStrategy
InitStrategyValues returns a list of the values for InitStrategy
func ParseInitStrategy ¶
func ParseInitStrategy(name string) (InitStrategy, error)
ParseInitStrategy attempts to convert a string to a InitStrategy.
func (*InitStrategy) AppendText ¶ added in v0.28.0
func (x *InitStrategy) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (InitStrategy) IsValid ¶
func (x InitStrategy) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (InitStrategy) MarshalText ¶
func (x InitStrategy) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (InitStrategy) String ¶
func (x InitStrategy) String() string
String implements the Stringer interface.
func (*InitStrategy) UnmarshalText ¶
func (x *InitStrategy) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type ListenConfig ¶
type ListenConfig []string
ListenConfig is a list of address(es) to listen on
func (*ListenConfig) UnmarshalText ¶
func (l *ListenConfig) UnmarshalText(data []byte) error
UnmarshalText implements `encoding.TextUnmarshaler`.
func (*ListenConfig) UnmarshalYAML ¶ added in v0.27.0
func (l *ListenConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML creates a ListenConfig from YAML
type Metrics ¶
type Metrics struct {
Enable bool `default:"false" yaml:"enable"`
Path string `default:"/metrics" yaml:"path"`
}
Metrics contains the config values for prometheus
type NetProtocol ¶
type NetProtocol uint16
NetProtocol resolver protocol ENUM( tcp+udp // TCP and UDP protocols tcp-tls // TCP-TLS protocol https // HTTPS protocol )
const ( // NetProtocolTcpUdp is a NetProtocol of type Tcp+Udp. // TCP and UDP protocols NetProtocolTcpUdp NetProtocol = iota // NetProtocolTcpTls is a NetProtocol of type Tcp-Tls. // TCP-TLS protocol NetProtocolTcpTls // NetProtocolHttps is a NetProtocol of type Https. // HTTPS protocol NetProtocolHttps )
func NetProtocolValues ¶
func NetProtocolValues() []NetProtocol
NetProtocolValues returns a list of the values for NetProtocol
func ParseNetProtocol ¶
func ParseNetProtocol(name string) (NetProtocol, error)
ParseNetProtocol attempts to convert a string to a NetProtocol.
func (*NetProtocol) AppendText ¶ added in v0.28.0
func (x *NetProtocol) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (NetProtocol) IsValid ¶
func (x NetProtocol) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (NetProtocol) MarshalText ¶
func (x NetProtocol) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (NetProtocol) String ¶
func (x NetProtocol) String() string
String implements the Stringer interface.
func (*NetProtocol) UnmarshalText ¶
func (x *NetProtocol) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Ports ¶
type Ports struct {
DNS ListenConfig `default:"53" yaml:"dns"`
HTTP ListenConfig `yaml:"http"`
HTTPS ListenConfig `yaml:"https"`
TLS ListenConfig `yaml:"tls"`
DOHPath string `default:"/dns-query" yaml:"dohPath"`
}
type QType ¶
func (*QType) UnmarshalText ¶
UnmarshalText implements `encoding.TextUnmarshaler`.
type QTypeSet ¶
type QTypeSet map[QType]struct{}
func NewQTypeSet ¶
func (*QTypeSet) UnmarshalYAML ¶
type QueryLog ¶
type QueryLog struct {
Target string `yaml:"target"`
Type QueryLogType `yaml:"type"`
LogRetentionDays uint64 `yaml:"logRetentionDays"`
CreationAttempts int `default:"3" yaml:"creationAttempts"`
CreationCooldown Duration `default:"2s" yaml:"creationCooldown"`
Fields []QueryLogField `yaml:"fields"`
FlushInterval Duration `default:"30s" yaml:"flushInterval"`
Ignore QueryLogIgnore `yaml:"ignore"`
}
QueryLog configuration for the query logging
func (*QueryLog) SetDefaults ¶
func (c *QueryLog) SetDefaults()
SetDefaults implements `defaults.Setter`.
type QueryLogField ¶
type QueryLogField string
QueryLogField data field to be logged ENUM(clientIP,clientName,responseReason,responseAnswer,question,duration)
const ( // QueryLogFieldClientIP is a QueryLogField of type clientIP. QueryLogFieldClientIP QueryLogField = "clientIP" // QueryLogFieldClientName is a QueryLogField of type clientName. QueryLogFieldClientName QueryLogField = "clientName" // QueryLogFieldResponseReason is a QueryLogField of type responseReason. QueryLogFieldResponseReason QueryLogField = "responseReason" // QueryLogFieldResponseAnswer is a QueryLogField of type responseAnswer. QueryLogFieldResponseAnswer QueryLogField = "responseAnswer" // QueryLogFieldQuestion is a QueryLogField of type question. QueryLogFieldQuestion QueryLogField = "question" // QueryLogFieldDuration is a QueryLogField of type duration. QueryLogFieldDuration QueryLogField = "duration" )
func ParseQueryLogField ¶
func ParseQueryLogField(name string) (QueryLogField, error)
ParseQueryLogField attempts to convert a string to a QueryLogField.
func QueryLogFieldValues ¶
func QueryLogFieldValues() []QueryLogField
QueryLogFieldValues returns a list of the values for QueryLogField
func (*QueryLogField) AppendText ¶ added in v0.28.0
func (x *QueryLogField) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (QueryLogField) IsValid ¶
func (x QueryLogField) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (QueryLogField) MarshalText ¶
func (x QueryLogField) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (QueryLogField) String ¶
func (x QueryLogField) String() string
String implements the Stringer interface.
func (*QueryLogField) UnmarshalText ¶
func (x *QueryLogField) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type QueryLogIgnore ¶
type QueryLogIgnore struct {
SUDN bool `default:"false" yaml:"sudn"`
}
type QueryLogType ¶
type QueryLogType int16
QueryLogType type of the query log ENUM( console // use logger as fallback none // no logging mysql // MySQL or MariaDB database postgresql // PostgreSQL database csv // CSV file per day csv-client // CSV file per day and client timescale // Timescale database )
const ( // QueryLogTypeConsole is a QueryLogType of type Console. // use logger as fallback QueryLogTypeConsole QueryLogType = iota // QueryLogTypeNone is a QueryLogType of type None. // no logging QueryLogTypeNone // QueryLogTypeMysql is a QueryLogType of type Mysql. // MySQL or MariaDB database QueryLogTypeMysql // QueryLogTypePostgresql is a QueryLogType of type Postgresql. // PostgreSQL database QueryLogTypePostgresql // QueryLogTypeCsv is a QueryLogType of type Csv. // CSV file per day QueryLogTypeCsv // QueryLogTypeCsvClient is a QueryLogType of type Csv-Client. // CSV file per day and client QueryLogTypeCsvClient // QueryLogTypeTimescale is a QueryLogType of type Timescale. // Timescale database QueryLogTypeTimescale )
func ParseQueryLogType ¶
func ParseQueryLogType(name string) (QueryLogType, error)
ParseQueryLogType attempts to convert a string to a QueryLogType.
func QueryLogTypeValues ¶
func QueryLogTypeValues() []QueryLogType
QueryLogTypeValues returns a list of the values for QueryLogType
func (*QueryLogType) AppendText ¶ added in v0.28.0
func (x *QueryLogType) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (QueryLogType) IsValid ¶
func (x QueryLogType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (QueryLogType) MarshalText ¶
func (x QueryLogType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (QueryLogType) String ¶
func (x QueryLogType) String() string
String implements the Stringer interface.
func (*QueryLogType) UnmarshalText ¶
func (x *QueryLogType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Redis ¶
type Redis struct {
Address string `yaml:"address"`
Username string `default:"" yaml:"username"`
Password string `default:"" yaml:"password"`
Database int `default:"0" yaml:"database"`
Required bool `default:"false" yaml:"required"`
ConnectionAttempts int `default:"3" yaml:"connectionAttempts"`
ConnectionCooldown Duration `default:"1s" yaml:"connectionCooldown"`
SentinelUsername string `default:"" yaml:"sentinelUsername"`
SentinelPassword string `default:"" yaml:"sentinelPassword"`
SentinelAddresses []string `yaml:"sentinelAddresses"`
}
Redis configuration for the redis connection
type RewriterConfig ¶
type RewriterConfig struct {
Rewrite map[string]string `yaml:"rewrite"`
FallbackUpstream bool `default:"false" yaml:"fallbackUpstream"`
}
RewriterConfig custom DNS configuration
func (*RewriterConfig) IsEnabled ¶
func (c *RewriterConfig) IsEnabled() bool
IsEnabled implements `config.Configurable`.
func (*RewriterConfig) LogConfig ¶
func (c *RewriterConfig) LogConfig(logger *logrus.Entry)
LogConfig implements `config.Configurable`.
func (*RewriterConfig) NormalizeRewrites ¶ added in v0.28.0
func (c *RewriterConfig) NormalizeRewrites()
NormalizeRewrites normalizes the rewrite keys to lowercase
type SUDN ¶
type SUDN struct {
// These are "recommended for private use" but not mandatory.
// If a user wishes to use one, it will most likely be via conditional
// upstream or custom DNS, which come before SUDN in the resolver chain.
// Thus defaulting to `true` and returning NXDOMAIN here should not conflict.
RFC6762AppendixG bool `default:"true" yaml:"rfc6762-appendixG"`
Enable bool `default:"true" yaml:"enable"`
}
SUDN configuration for Special Use Domain Names
type SourceLoading ¶
type SourceLoading struct {
Init `yaml:",inline"`
Concurrency uint `default:"4" yaml:"concurrency"`
MaxErrorsPerSource int `default:"5" yaml:"maxErrorsPerSource"`
RefreshPeriod Duration `default:"4h" yaml:"refreshPeriod"`
Downloads Downloader `yaml:"downloads"`
}
func (*SourceLoading) LogConfig ¶
func (c *SourceLoading) LogConfig(logger *logrus.Entry)
func (*SourceLoading) StartPeriodicRefresh ¶
type TLSVersion ¶
type TLSVersion int // values MUST match `tls.VersionTLS*`
TLSVersion represents a TLS protocol version. ENUM( 1.0 = 769 1.1 1.2 1.3 )
const ( // TLSVersion10 is a TLSVersion of type 1.0. TLSVersion10 TLSVersion = iota + 769 // TLSVersion11 is a TLSVersion of type 1.1. TLSVersion11 // TLSVersion12 is a TLSVersion of type 1.2. TLSVersion12 // TLSVersion13 is a TLSVersion of type 1.3. TLSVersion13 )
func ParseTLSVersion ¶
func ParseTLSVersion(name string) (TLSVersion, error)
ParseTLSVersion attempts to convert a string to a TLSVersion.
func TLSVersionValues ¶
func TLSVersionValues() []TLSVersion
TLSVersionValues returns a list of the values for TLSVersion
func (*TLSVersion) AppendText ¶ added in v0.28.0
func (x *TLSVersion) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (TLSVersion) IsValid ¶
func (x TLSVersion) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (TLSVersion) MarshalText ¶
func (x TLSVersion) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (TLSVersion) String ¶
func (x TLSVersion) String() string
String implements the Stringer interface.
func (*TLSVersion) UnmarshalText ¶
func (x *TLSVersion) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Upstream ¶
type Upstream struct {
Net NetProtocol
Host string
Port uint16
Path string
CommonName string // Common Name to use for certificate verification; optional. "" uses .Host
// DNS stamp metadata (optional) - only populated when parsing DNS stamps
CertificateFingerprints []CertificateFingerprint // SHA256 fingerprints for TLS certificate pinning
}
Upstream is the definition of external DNS server
func ParseUpstream ¶
ParseUpstream creates new Upstream from passed string in format net:host[:port][/path][#commonname] or DNS Stamp format: sdns://...
func (*Upstream) UnmarshalText ¶
UnmarshalText implements `encoding.TextUnmarshaler`.
type UpstreamGroup ¶
UpstreamGroup represents the config for one group (upstream branch)
func NewUpstreamGroup ¶
func NewUpstreamGroup(name string, cfg Upstreams, upstreams []Upstream) UpstreamGroup
NewUpstreamGroup creates an UpstreamGroup with the given name and upstreams.
The upstreams from `cfg.Groups` are ignored.
func (*UpstreamGroup) GroupUpstreams ¶
func (c *UpstreamGroup) GroupUpstreams() []Upstream
func (*UpstreamGroup) IsEnabled ¶
func (c *UpstreamGroup) IsEnabled() bool
IsEnabled implements `config.Configurable`.
func (*UpstreamGroup) LogConfig ¶
func (c *UpstreamGroup) LogConfig(logger *logrus.Entry)
LogConfig implements `config.Configurable`.
type UpstreamGroups ¶
type UpstreamStrategy ¶
type UpstreamStrategy uint8
UpstreamStrategy data field to be logged ENUM(parallel_best,strict,random)
const ( // UpstreamStrategyParallelBest is a UpstreamStrategy of type Parallel_best. UpstreamStrategyParallelBest UpstreamStrategy = iota // UpstreamStrategyStrict is a UpstreamStrategy of type Strict. UpstreamStrategyStrict // UpstreamStrategyRandom is a UpstreamStrategy of type Random. UpstreamStrategyRandom )
func ParseUpstreamStrategy ¶
func ParseUpstreamStrategy(name string) (UpstreamStrategy, error)
ParseUpstreamStrategy attempts to convert a string to a UpstreamStrategy.
func UpstreamStrategyValues ¶
func UpstreamStrategyValues() []UpstreamStrategy
UpstreamStrategyValues returns a list of the values for UpstreamStrategy
func (*UpstreamStrategy) AppendText ¶ added in v0.28.0
func (x *UpstreamStrategy) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (UpstreamStrategy) IsValid ¶
func (x UpstreamStrategy) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (UpstreamStrategy) MarshalText ¶
func (x UpstreamStrategy) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (UpstreamStrategy) String ¶
func (x UpstreamStrategy) String() string
String implements the Stringer interface.
func (*UpstreamStrategy) UnmarshalText ¶
func (x *UpstreamStrategy) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Upstreams ¶
type Upstreams struct {
Init Init `yaml:"init"`
Timeout Duration `default:"2s" yaml:"timeout"` // always > 0
Groups UpstreamGroups `yaml:"groups"`
Strategy UpstreamStrategy `default:"parallel_best" yaml:"strategy"`
UserAgent string `yaml:"userAgent"`
}
Upstreams upstream servers configuration
type ZoneFileDNS ¶
type ZoneFileDNS struct {
RRs CustomDNSMapping
// contains filtered or unexported fields
}
func (*ZoneFileDNS) UnmarshalYAML ¶
func (z *ZoneFileDNS) UnmarshalYAML(unmarshal func(interface{}) error) error