handler

package
v0.73.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package handler provides some customizable DNS request handling logic used in the proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Default

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

Default implements the default configurable proxy.RequestHandler.

func NewDefault

func NewDefault(conf *DefaultConfig) (d *Default, err error)

NewDefault creates a new Default handler.

func (*Default) HandleRequest

func (h *Default) HandleRequest(p *proxy.Proxy, proxyCtx *proxy.DNSContext) (err error)

HandleRequest resolves the DNS request within proxyCtx. It only calls proxy.Proxy.Resolve if the request isn't handled by any of the internal handlers.

type DefaultConfig

type DefaultConfig struct {
	// MessageConstructor constructs DNS messages.  It must not be nil.
	MessageConstructor proxy.MessageConstructor

	// FileSystem is the file system for reading files from.  It must not be
	// nil.
	FileSystem fs.FS

	// Logger is the logger.  It must not be nil.
	Logger *slog.Logger

	// HostsFiles is the list of paths to the hosts files.  The hosts files
	// aren't used if the list is empty.
	//
	// TODO(e.burkov):  Consider passing just a [hostsfile.Storage].
	HostsFiles []string

	// HaltIPv6 halts the processing of AAAA requests and makes the handler
	// reply with NODATA to them.
	HaltIPv6 bool
}

DefaultConfig is the configuration for Default.

Jump to

Keyboard shortcuts

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