Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DohMaxConnsPerHost = 0
DohMaxConnsPerHost controls the maximum number of connections per host nolint
var RootCAs *x509.CertPool
RootCAs is the CertPool that must be used by all upstreams Redefining RootCAs makes sense on iOS to overcome the 15MB memory limit of the NEPacketTunnelProvider nolint
Functions ¶
func LookupParallel ¶ added in v0.10.0
LookupParallel starts parallel lookup for host ip with many Resolvers First answer without error will be returned Return nil and error if count of errors equals count of resolvers
Types ¶
type Options ¶ added in v0.11.0
type Options struct { // Bootstrap is a list of plain DNS servers to be used to resolve DOH/DOT hostnames (if any) Bootstrap []string // Timeout is the default upstream timeout. Also, it is used as a timeout for bootstrap DNS requests. // timeout=0 means infinite timeout. Timeout time.Duration // ServerIP allows specifying the resolver's IP address. In the case if it's specified, // bootstrap DNS servers won't be used at all. ServerIP net.IP }
Options for AddressToUpstream func
type Resolver ¶ added in v0.10.0
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is wrapper for resolver and it's address
func NewResolver ¶ added in v0.10.0
NewResolver creates an instance of Resolver structure with defined net.Resolver and it's address resolverAddress is address of net.Resolver The host in the address parameter of Dial func will always be a literal IP address (from documentation)
type TLSPool ¶
type TLSPool struct {
// contains filtered or unexported fields
}
TLSPool is a connections pool for the DNS-over-TLS Upstream.
Example:
pool := TLSPool{Address: "tls://1.1.1.1:853"} netConn, err := pool.Get() if err != nil {panic(err)} c := dns.Conn{Conn: netConn} q := dns.Msg{} q.SetQuestion("google.com.", dns.TypeA) log.Println(q) err = c.WriteMsg(&q) if err != nil {panic(err)} r, err := c.ReadMsg() if err != nil {panic(err)} log.Println(r) pool.Put(c.Conn)
func (*TLSPool) Create ¶ added in v0.9.10
Create creates a new connection for the pool (but not puts it there)
type Upstream ¶
Upstream is an interface for a DNS resolver
func AddressToUpstream ¶
AddressToUpstream converts the specified address to an Upstream instance * 8.8.8.8:53 -- plain DNS * tcp://8.8.8.8:53 -- plain DNS over TCP * tls://1.1.1.1 -- DNS-over-TLS * https://dns.adguard.com/dns-query -- DNS-over-HTTPS * sdns://... -- DNS stamp (see https://dnscrypt.info/stamps-specifications)
func ExchangeParallel ¶ added in v0.10.0
ExchangeParallel function is called to parallel exchange dns request by many upstreams First answer without error will be returned We will return nil and error if count of errors equals count of upstreams