Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opt ¶
type Opt struct { // DialAddr specifies the address the upstream will // actually dial to. DialAddr string // Socks5 specifies the socks5 proxy server that the upstream // will connect though. // Not implemented for udp upstreams and doh upstreams with http/3. Socks5 string // SoMark sets the socket SO_MARK option in unix system. SoMark int // BindToDevice sets the socket SO_BINDTODEVICE option in unix system. BindToDevice string // IdleTimeout specifies the idle timeout for long-connections. // Available for TCP, DoT, DoH. // If negative, TCP, DoT will not reuse connections. // Default: TCP, DoT: 10s , DoH: 30s. IdleTimeout time.Duration // EnablePipeline enables query pipelining support as RFC 7766 6.2.1.1 suggested. // Available for TCP, DoT upstream with IdleTimeout >= 0. EnablePipeline bool // EnableHTTP3 enables HTTP/3 protocol for DoH upstream. EnableHTTP3 bool // MaxConns limits the total number of connections, including connections // in the dialing states. // Implemented for TCP/DoT pipeline enabled upstreams and DoH upstreams. // Default is 2. MaxConns int // Bootstrap specifies a plain dns server for the go runtime to solve the // domain of the upstream server. It SHOULD be an IP address. Custom port // is supported. // Note: Use a domain address may cause dead resolve loop and additional // latency to dial upstream server. // HTTP3 is not supported. Bootstrap string // TLSConfig specifies the tls.Config that the TLS client will use. // Available for DoT, DoH upstreams. TLSConfig *tls.Config // Logger specifies the logger that the upstream will use. Logger *zap.Logger }
type Upstream ¶
type Upstream interface { // ExchangeContext exchanges query message m to the upstream, and returns // response. It MUST NOT keep or modify m. ExchangeContext(ctx context.Context, m *dns.Msg) (*dns.Msg, error) // CloseIdleConnections closes any connections in the Upstream which // now sitting idle. It does not interrupt any connections currently in use. CloseIdleConnections() io.Closer }
Upstream represents a DNS upstream.
Click to show internal directories.
Click to hide internal directories.