Documentation ¶
Overview ¶
Package resolv supports resolv.conf formatted data (see also `man resolv.conf`). Supported are conversions from a file or string to an internal representation and back to a string.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Sys string
System resolv.conf name
Functions ¶
This section is empty.
Types ¶
type Cfg ¶
type Cfg struct {
// contains filtered or unexported fields
}
Cfg represents a resolv.conf with a change/modification guard/handler. Methods of Cfg are synchronized; multiple goroutines may invoke them concurrently.
func NewCfg ¶
NewCfg returns a newly created Cfg with resolv.Conf initialized from file fname of an Error of any. It binds the contained resolv.Conf to fname and on any changes to the fname file the Cfg resolv.Conf is reloaded on access via Cfg.Conf().
func (*Cfg) Conf ¶
Conf returns a resolv.Conf from Cfg and an indicator of its source file has been changed/modificated compared to the last invocation of this function or an Error if any.
func (*Cfg) SetChanged ¶
func (c *Cfg) SetChanged()
SetChanged forces next Conf() to handle modification of the wrapped resolv.Conf.
type Conf ¶
type Conf struct { // Internet address (in dot notation) of a name server that the resolver should query. Nameserver []net.IP // Local domain name. Domain string // Resolver queries having fewer than ndots dots (default is 1) // in them will be attempted using each component of the search path // in turn until a match is found. Search []string // This option allows addresses returned by a resolver to be sorted. Sortlist []SortlistItem Opt struct { Debug bool // The number of dots which must appear in a name before an initial absolute query will be made. // Default: 1 Ndots uint // Amount of time the resolver will wait for a response from a remote name server before retry. // Default: 5 TimeoutSecs uint // Number of times the resolver will send a query to its name servers before giving up. // Default: 2 Attempts uint // Round robin selection of nameservers from among those listed. Rotate bool // Disables the modern BIND checking of incoming hostnames and mail names for invalid characters. NoCheckNames bool // Try an AAAA query before an A query. Inet6 bool // This causes reverse IPv6 lookups to be made using the bit-label format described in RFC 2673. Ip6ByteString bool // Reverse IPv6 lookups are made in the (deprecated) ip6.int zone. Ip6Dotint bool // Enables support for the DNS extensions described in RFC 2671. Edns0 bool } }
A Conf holds the data found in a resolver configuration file, e.g. '/etc/resolv.conf'. See also resolv.conf(5)
func (*Conf) AppendSearch ¶
func (*Conf) LoadString ¶
Load Conf c with from a resolv.conf format string s. Return an Error, if any.
type GoCfg ¶
type GoCfg struct {
// contains filtered or unexported fields
}
GoCfg is a Cfg wrapped in a goroutine allowing for concurrent access.
func NewGoCfg ¶
NewGoCfg returns a newly created GoCfg or an Error if any. It is assumed there will be only one/few GoCfg instance(s) in an application. The instance(s) and its associated goroutine(s) will never be released. This is by design in an atempt to avoid some possibly nasty races on finalization. The "impossible to release" doesn't apply when NewGoCfg returns an Error.
type SortlistItem ¶
type SortlistItem struct {
Addr, NetMask net.IP // The netmask is optional and defaults to the natural netmask of the net.
}
'sortlist' Conf option
func (*SortlistItem) String ¶
func (i *SortlistItem) String() string