Source File
dnsconfig.go
Belonging Package
net
// Copyright 2022 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package netimport (_)// defaultNS is the default name servers to use in the absence of DNS configuration.//// defaultNS should be an internal detail,// but widely used packages access it using linkname.// Notable members of the hall of shame include:// - github.com/pojntfx/hydrapp/hydrapp// - github.com/mtibben/androiddnsfix// - github.com/metacubex/mihomo//// Do not remove or change the type signature.// See go.dev/issue/67401.////go:linkname defaultNSvar defaultNS = []string{"127.0.0.1:53", "[::1]:53"}var getHostname = os.Hostname // variable for testingtype dnsConfig struct {servers []string // server addresses (in host:port form) to usesearch []string // rooted suffixes to append to local namendots int // number of dots in name to trigger absolute lookuptimeout time.Duration // wait before giving up on a query, including retriesattempts int // lost packets before giving up on serverrotate bool // round robin among serversunknownOpt bool // anything unknown was encounteredlookup []string // OpenBSD top-level database "lookup" ordererr error // any error that occurs during open of resolv.confmtime time.Time // time of resolv.conf modificationsoffset uint32 // used by serverOffsetsingleRequest bool // use sequential A and AAAA queries instead of parallel queriesuseTCP bool // force usage of TCP for DNS resolutionstrustAD bool // add AD flag to queriesnoReload bool // do not check for config file updates}// serverOffset returns an offset that can be used to determine// indices of servers in c.servers when making queries.// When the rotate option is enabled, this offset increases.// Otherwise it is always 0.func ( *dnsConfig) () uint32 {if .rotate {return atomic.AddUint32(&.soffset, 1) - 1 // return 0 to start}return 0}
![]() |
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |