proxy

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxy

type Proxy struct {
	// Addr specifies the TCP/UDP address to listen to, :53 if empty.
	Addr string

	// Upstream specifies the resolver used for incoming queries.
	Upstream resolver.Resolver

	// BogusPriv specifies that reverse lookup on private subnets are answerd
	// with NXDOMAIN.
	BogusPriv bool

	// Timeout defines the maximum allowed time allowed for a request before
	// being cancelled.
	Timeout time.Duration

	// QueryLog specifies an optional log function called for each received query.
	QueryLog func(QueryInfo)

	// ErrorLog specifies an optional log function for errors. If not set,
	// errors are not reported.
	ErrorLog func(error)
}

Proxy is a DNS53 to DNS over anything proxy.

func (Proxy) ListenAndServe

func (p Proxy) ListenAndServe(ctx context.Context) error

ListenAndServe listens on UDP and TCP and serve DNS queries. If ctx is canceled, listeners are closed and ListenAndServe returns context.Canceled error.

func (Proxy) Resolve added in v1.1.3

func (p Proxy) Resolve(ctx context.Context, q resolver.Query, buf []byte) (n int, err error)

type QueryInfo

type QueryInfo struct {
	Protocol     string
	PeerIP       net.IP
	Type         string
	Name         string
	QuerySize    int
	ResponseSize int
	Duration     time.Duration
}

QueryInfo provides information about a DNS query handled by Proxy.

Jump to

Keyboard shortcuts

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