dnssvc

package
v0.108.0-b.31 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: GPL-3.0 Imports: 9 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

	// Upstreams are the DNS upstreams to use.  If not set, upstreams are
	// created using data from BootstrapServers, UpstreamServers, and
	// UpstreamTimeout.
	//
	// TODO(a.garipov): Think of a better scheme.  Those other three parameters
	// are here only to make Config work properly.
	Upstreams []upstream.Upstream

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

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

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

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.

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