upstream

package
v2.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FastUpstream

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

func NewFastUpstream

func NewFastUpstream(addr string, options ...Option) (*FastUpstream, error)

func (*FastUpstream) Address

func (u *FastUpstream) Address() string

func (*FastUpstream) Exchange

func (u *FastUpstream) Exchange(q *dns.Msg) (r *dns.Msg, err error)

type Option

type Option func(u *FastUpstream) error

func WithDialAddr

func WithDialAddr(s string) Option

func WithIdleTimeout

func WithIdleTimeout(d time.Duration) Option

func WithInsecureSkipVerify

func WithInsecureSkipVerify(b bool) Option

func WithLogger

func WithLogger(l *zap.Logger) Option

func WithMaxConns

func WithMaxConns(n int) Option

func WithReadTimeout

func WithReadTimeout(d time.Duration) Option

func WithRootCAs

func WithRootCAs(cp *x509.CertPool) Option

func WithSocks5

func WithSocks5(s string) Option

type Transport

type Transport struct {
	// Nil logger disables logging.
	Logger *zap.Logger

	// The following funcs cannot be nil.
	DialFunc  func() (net.Conn, error)
	WriteFunc func(c io.Writer, m *dns.Msg) (n int, err error)
	ReadFunc  func(c io.Reader) (m *dns.Msg, n int, err error)
	// MaxConns controls the maximum connections Transport can open.
	// It includes dialing connections.
	// Default is 1.
	MaxConns int

	// IdleTimeout controls the maximum idle time for each connection.
	// If IdleTimeout <= 0, Transport will not reuse connections.
	IdleTimeout time.Duration

	// Timeout controls the read timeout for each read operation.
	// Default is defaultReadTimeout.
	Timeout time.Duration
	// contains filtered or unexported fields
}

func (*Transport) Exchange

func (t *Transport) Exchange(q *dns.Msg) (r *dns.Msg, err error)

Jump to

Keyboard shortcuts

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