Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Transport ¶
type Transport struct { // Nil logger disables logging. Logger *zap.Logger // The following funcs cannot be nil. // DialFunc specifies the method to dial a connection to the server. DialFunc func(ctx context.Context) (net.Conn, error) // WriteFunc specifies the method to write a wire dns msg to the connection // opened by the DialFunc. 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 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. // If IdleTimeout < 0, Transport will not reuse connections. // Default is defaultIdleTimeout. IdleTimeout time.Duration // If EnablePipeline is set and IdleTimeout > 0, the Transport will pipeline // queries as RFC 7766 6.2.1.1 suggested. EnablePipeline bool // MaxConns controls the maximum pipeline connections Transport can open. // It includes dialing connections. // Default is defaultMaxConns. // Each connection can handle no more than 65535 queries concurrently. // Typically, it is very rare reaching that limit. MaxConns int // MaxQueryPerConn controls the maximum queries that one pipeline connection // can handle. The connection will be closed if it reached the limit. // Default is defaultMaxQueryPerConn. MaxQueryPerConn uint16 // contains filtered or unexported fields }
Transport is a DNS msg transport that supposes DNS over UDP,TCP,TLS. For UDP, it can reuse UDP sockets. For TCP and DoT, it implements RFC 7766 and supports pipeline mode and can handle out-of-order responses.
func (*Transport) Close ¶
Close closes the Transport and all its active connections. All going queries will fail instantly. It always returns nil error.
func (*Transport) CloseIdleConnections ¶
func (t *Transport) CloseIdleConnections()
Click to show internal directories.
Click to hide internal directories.