proxy

package
v1.4.28 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: MIT Imports: 13 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

	// UseHosts specifies that /etc/hosts needs to be checked before calling the
	// upstream resolver.
	UseHosts 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)

	// InfoLog specifies an option log function called when some actions are
	// performed.
	InfoLog func(string)

	// 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, i resolver.ResolveInfo, err error)

type QueryInfo

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

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