server

package
v2.0.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerNotRunning      = errors.New("server not running")
	ErrListeningUDPTCPDiffer = errors.New("udp and tcp listening addresses differ")
)
View Source
var (
	ErrListeningAddressNotValid = errors.New("listening address is not valid")
	ErrDialerNotSet             = errors.New("dialer is not set")
)

Functions

This section is empty.

Types

type Dialer

type Dialer interface {
	Dial(ctx context.Context, network, _ string) (conn net.Conn, err error)
	// String returns the connection type the dialer will use, for example
	// "dns over tls".
	String() string
}

type Logger

type Logger interface {
	Info(s string)
	Warner
}

type Middleware

type Middleware interface {
	String() string
	Wrap(next dns.Handler) dns.Handler
	Stop() (err error)
}

type Server

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

func New

func New(settings Settings) (server *Server, err error)

func (*Server) ListeningAddress

func (s *Server) ListeningAddress() (address netip.AddrPort, err error)

func (*Server) Start

func (s *Server) Start(ctx context.Context) (runError <-chan error, startErr error)

func (*Server) Stop

func (s *Server) Stop() (err error)

func (*Server) String

func (s *Server) String() string

type Settings

type Settings struct {
	// ListeningAddress is the server listening address, and defaults
	// to ":53".
	ListeningAddress *string
	// Dialer is used to establish connections with upstream resolvers
	// and must be set.
	Dialer Dialer
	// Middlewares is a list of middlewares to use.
	// The first one is the first wrapper, and the last one
	// is the last wrapper of the handlers in the chain.
	Middlewares []Middleware
	// Logger is the logger to log information.
	// It defaults to a No-Op logger implementation.
	Logger Logger
}

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