dns_handler

package
v4.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyServerHandler

type DummyServerHandler struct {
	T       *testing.T
	WantMsg *dns.Msg
	WantErr error
}

func (*DummyServerHandler) ServeDNS

func (d *DummyServerHandler) ServeDNS(_ context.Context, req *dns.Msg, meta *query_context.RequestMeta) (*dns.Msg, error)

type EntryHandler added in v4.3.0

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

func NewEntryHandler added in v4.3.0

func NewEntryHandler(opts EntryHandlerOpts) (*EntryHandler, error)

func (*EntryHandler) ServeDNS added in v4.3.0

func (h *EntryHandler) ServeDNS(ctx context.Context, req *dns.Msg, meta *query_context.RequestMeta) (*dns.Msg, error)

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

type EntryHandlerOpts added in v4.3.0

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

	Entry executable_seq.Executable

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

	// RecursionAvailable sets the dns.Msg.RecursionAvailable flag globally.
	RecursionAvailable bool
}

func (*EntryHandlerOpts) Init added in v4.3.0

func (opts *EntryHandlerOpts) Init() error

type Handler

type Handler interface {
	// ServeDNS handles incoming request req and returns a response.
	// Implements must not keep and use req after the ServeDNS returned.
	// ServeDNS should handle dns errors by itself and return a proper error responses
	// for clients.
	// ServeDNS should always return a responses.
	// If ServeDNS returns an error, caller considers that the error is associated
	// with the downstream connection and will close the downstream connection
	// immediately.
	// All input parameters won't be nil.
	ServeDNS(ctx context.Context, req *dns.Msg, meta *query_context.RequestMeta) (*dns.Msg, error)
}

Handler handles dns query.

Jump to

Keyboard shortcuts

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