dnssvc

package
v0.108.0-b.54 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package dnssvc contains the AdGuard Home DNS service.

TODO(a.garipov): Define, if all methods of a *Service should work with a nil receiver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Addresses are the addresses on which to serve plain DNS queries.
	Addresses []netip.AddrPort

	// BootstrapServers are the addresses of DNS servers used for bootstrapping
	// the upstream DNS server addresses.
	BootstrapServers []string

	// UpstreamServers are the upstream DNS server addresses to use.
	UpstreamServers []string

	// DNS64Prefixes is a slice of NAT64 prefixes to be used for DNS64.  See
	// also [Config.UseDNS64].
	DNS64Prefixes []netip.Prefix

	// UpstreamTimeout is the timeout for upstream requests.
	UpstreamTimeout time.Duration

	// BootstrapPreferIPv6, if true, instructs the bootstrapper to prefer IPv6
	// addresses to IPv4 ones when bootstrapping.
	BootstrapPreferIPv6 bool

	// UseDNS64, if true, enables DNS64 protection for incoming requests.
	UseDNS64 bool
}

Config is the AdGuard Home DNS service configuration structure.

TODO(a.garipov): Add timeout for incoming requests.

type Service

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

Service is the AdGuard Home DNS service. A nil *Service is a valid agh.Service that does nothing.

TODO(a.garipov): Consider saving a *proxy.Config instance for those fields that are only used in New and Service.Config.

func New

func New(c *Config) (svc *Service, err error)

New returns a new properly initialized *Service. If c is nil, svc is a nil *Service that does nothing. The fields of c must not be modified after calling New.

func (*Service) Config

func (svc *Service) Config() (c *Config)

Config returns the current configuration of the web service. Config must not be called simultaneously with Start. If svc was initialized with ":0" addresses, addrs will not return the actual bound ports until Start is finished.

func (*Service) Shutdown

func (svc *Service) Shutdown(ctx context.Context) (err error)

Shutdown implements the agh.Service interface for *Service. svc may be nil.

func (*Service) Start

func (svc *Service) Start() (err error)

Start implements the agh.Service interface for *Service. svc may be nil. After Start exits, all DNS servers have tried to start, but there is no guarantee that they did. Errors from the servers are written to the log.

Jump to

Keyboard shortcuts

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