transport

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 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 IOOpts

type IOOpts struct {
	// DialFunc specifies the method to dial a connection to the server.
	// DialFunc MUST NOT be nil.
	DialFunc func(ctx context.Context) (io.ReadWriteCloser, error)
	// WriteFunc specifies the method to write a wire dns msg to the connection
	// opened by the DialFunc.
	// WriteFunc MUST NOT be nil.
	WriteFunc func(c io.Writer, m *dns.Msg) (int, error)
	// ReadFunc specifies the method to read a wire dns msg from the connection
	// opened by the DialFunc.
	// ReadFunc MUST NOT be nil.
	ReadFunc func(c io.Reader) (*dns.Msg, int, error)

	// DialTimeout specifies the timeout for DialFunc.
	// Default is defaultDialTimeout.
	DialTimeout time.Duration

	// IdleTimeout controls the maximum idle time for each connection.
	// Default is defaultIdleTimeout.
	IdleTimeout time.Duration
}

type PipelineOpts

type PipelineOpts struct {
	IOOpts

	// MaxConns controls the maximum pipeline connections Transport can open.
	// It includes dialing connections.
	// Default is defaultPipelineMaxConns.
	// Users that have heavy traffic flow should consider to increase
	// this for better load-balancing and latency.
	MaxConn int
}

type PipelineTransport

type PipelineTransport struct {
	PipelineOpts
	// contains filtered or unexported fields
}

PipelineTransport will pipeline queries as RFC 7766 6.2.1.1 suggested. It also can reuse udp socket. Since dns over udp is some kind of "pipeline".

func NewPipelineTransport

func NewPipelineTransport(opt PipelineOpts) *PipelineTransport

func (*PipelineTransport) Close

func (t *PipelineTransport) Close() error

Close closes PipelineTransport and all its connections. It always returns a nil error.

func (*PipelineTransport) ExchangeContext

func (t *PipelineTransport) ExchangeContext(ctx context.Context, m *dns.Msg) (*dns.Msg, error)

type ReuseConnOpts

type ReuseConnOpts struct {
	IOOpts
}

type ReuseConnTransport

type ReuseConnTransport struct {
	ReuseConnOpts
	// contains filtered or unexported fields
}

func NewReuseConnTransport

func NewReuseConnTransport(opt ReuseConnOpts) *ReuseConnTransport

func (*ReuseConnTransport) Close

func (t *ReuseConnTransport) Close() error

Close closes ReuseConnTransport and all its connections. It always returns a nil error.

func (*ReuseConnTransport) ExchangeContext

func (t *ReuseConnTransport) ExchangeContext(ctx context.Context, m *dns.Msg) (*dns.Msg, error)

Jump to

Keyboard shortcuts

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