config

package
v2.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLocalResolverAddressNotValid = errors.New("local resolver address is not valid")
	ErrLocalResolverPortIsZero      = errors.New("local resolver port is zero")
)
View Source
var (
	ErrCacheLRUMaxEntriesNegative = errors.New("max entries is negative")
	ErrCacheLRUMaxEntriesZero     = errors.New("max entries is zero")
)
View Source
var ErrMiddlewareLogPathNotDirectory = errors.New("filepath specified for the middleware log is a directory")
View Source
var (
	ErrTimeoutTooSmall = errors.New("timeout is too small")
)
View Source
var (
	ErrUpdatePeriodTooShort = errors.New("update period is too short")
)

Functions

This section is empty.

Types

type Block

type Block struct {
	BlockMalicious       *bool
	BlockAds             *bool
	BlockSurveillance    *bool
	AllowedHosts         []string
	AllowedIPs           []netip.Addr
	AllowedIPPrefixes    []netip.Prefix
	AddBlockedHosts      []string
	AddBlockedIPs        []netip.Addr
	AddBlockedIPPrefixes []netip.Prefix
}

func (*Block) String

func (b *Block) String() string

func (*Block) ToLinesNode

func (b *Block) ToLinesNode() (node *gotree.Node)

type Cache

type Cache struct {
	// Type is the cache type, and can be
	// 'lru' or 'noop'. It defaults to 'lru' if
	// left unset.
	Type string
	LRU  CacheLRU
}

func (*Cache) String

func (c *Cache) String() string

func (*Cache) ToLinesNode

func (c *Cache) ToLinesNode() (node *gotree.Node)

type CacheLRU

type CacheLRU struct {
	// MaxEntries is the number of maximum entries
	// to keep in the LRU cache. It defaults to 10e4
	// if letf unset.
	// Note its type is int instead of uint* since it is
	// used to compare against an int length so its maximum
	// is math.MaxInt which depends on the platform.
	MaxEntries int
}

func (*CacheLRU) String

func (c *CacheLRU) String() string

func (*CacheLRU) ToLinesNode

func (c *CacheLRU) ToLinesNode() (node *gotree.Node)

type DoH

type DoH struct {
	// UpstreamResolvers is a list of DNS over HTTPS upstream
	// resolvers to use.
	UpstreamResolvers []string
	// Timeout is the maximum duration to wait for a response from
	// upstream DNS over HTTPS servers. If left unset, it defaults
	// to 1 second.
	Timeout time.Duration
}

func (*DoH) String

func (d *DoH) String() string

func (*DoH) ToLinesNode

func (d *DoH) ToLinesNode() (node *gotree.Node)

type DoT

type DoT struct {
	// UpstreamResolvers is a list of DNS over TLS upstream
	// resolvers to use.
	UpstreamResolvers []string
	// Timeout is the maximum duration to wait for a response from
	// upstream DNS over TLS servers. If left unset, it defaults to
	// 1 second.
	Timeout time.Duration
}

func (*DoT) String

func (d *DoT) String() string

func (*DoT) ToLinesNode

func (d *DoT) ToLinesNode() (node *gotree.Node)

type LocalDNS

type LocalDNS struct {
	Enabled   *bool
	Resolvers []netip.AddrPort
}

func (*LocalDNS) String

func (l *LocalDNS) String() string

func (*LocalDNS) ToLinesNode

func (l *LocalDNS) ToLinesNode() (node *gotree.Node)

type Log

type Log struct {
	Level  string
	Caller string
}

func (*Log) String

func (l *Log) String() string

func (*Log) ToLinesNode

func (l *Log) ToLinesNode() (node *gotree.Node)

func (Log) ToOptions

func (l Log) ToOptions() (options []log.Option)

type Metrics

type Metrics struct {
	Type       string
	Prometheus Prometheus
}

func (*Metrics) String

func (m *Metrics) String() string

func (*Metrics) ToLinesNode

func (m *Metrics) ToLinesNode() (node *gotree.Node)

type MiddlewareLog

type MiddlewareLog struct {
	Enabled      *bool
	DirPath      string
	LogRequests  *bool
	LogResponses *bool
}

func (*MiddlewareLog) String

func (m *MiddlewareLog) String() string

func (*MiddlewareLog) ToLinesNode

func (m *MiddlewareLog) ToLinesNode() (node *gotree.Node)

type Prometheus

type Prometheus struct {
	ListeningAddress string
	Subsystem        *string
}

func (*Prometheus) SetDefaults

func (p *Prometheus) SetDefaults()

func (*Prometheus) String

func (p *Prometheus) String() string

func (*Prometheus) ToLinesNode

func (p *Prometheus) ToLinesNode() (node *gotree.Node)

func (*Prometheus) Validate

func (p *Prometheus) Validate() (err error)

type Settings

type Settings struct {
	// Upstream is the DNS upstream connection type
	// and can be either 'dot' or 'doh'.
	// It defaults to 'dot' if left uset.
	Upstream string
	// ListeningAddress is the DNS server listening address.
	// It can be set to the empty string to listen on all interfaces
	// on a random available port.
	// It defaults to ":53".
	ListeningAddress *string
	Block            Block
	Cache            Cache
	DoH              DoH
	DoT              DoT
	Log              Log
	MiddlewareLog    MiddlewareLog
	Metrics          Metrics
	LocalDNS         LocalDNS
	CheckDNS         *bool
	UpdatePeriod     *time.Duration
}

Settings contain settings to configure the entire program and to live patch the program from external sources.

func (*Settings) Read

func (s *Settings) Read(reader *reader.Reader, warner Warner) (err error)

func (*Settings) SetDefaults

func (s *Settings) SetDefaults()

func (*Settings) String

func (s *Settings) String() string

func (*Settings) ToLinesNode

func (s *Settings) ToLinesNode() (node *gotree.Node)

func (*Settings) Validate

func (s *Settings) Validate() (err error)

type Warner

type Warner interface {
	Warn(s string)
}

Jump to

Keyboard shortcuts

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