dns_handler

package
v5.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntryHandler

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

func NewEntryHandler

func NewEntryHandler(opts EntryHandlerOpts) *EntryHandler

func (*EntryHandler) ServeDNS

func (h *EntryHandler) ServeDNS(ctx context.Context, qCtx *query_context.Context) error

ServeDNS implements Handler. If entry returns an error, a SERVFAIL response will be set. If entry returns without a response, a REFUSED response will be set.

type EntryHandlerOpts

type EntryHandlerOpts struct {
	// Logger is used for logging. Default is a noop logger.
	Logger *zap.Logger

	// Required.
	Entry sequence.Executable

	// QueryTimeout limits the timeout value of each query.
	// Default is defaultQueryTimeout.
	QueryTimeout time.Duration
}

type Handler

type Handler interface {
	// ServeDNS handles incoming request qCtx and MUST ALWAYS set a response.
	// Implements must not keep and use qCtx after the ServeDNS returned.
	// ServeDNS should handle dns errors by itself and return a proper error responses
	// for clients.
	// If ServeDNS returns an error, caller considers that the error is associated
	// with the downstream connection and will close the downstream connection
	// immediately.
	ServeDNS(ctx context.Context, qCtx *query_context.Context) error
}

Handler handles dns query.

Jump to

Keyboard shortcuts

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