Documentation ¶
Overview ¶
Package resolvconf provides a parser for resolv.conf files.
Inspired from nerdctl's resolvconf and tailscale's resolvconffile.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultPath is the default path to the resolv.conf that contains information to resolve DNS. DefaultPath = "/etc/resolv.conf" // SystemdPath is systemd's default path to the resolv.conf that contains information to resolve DNS. // This path is used when we detect systemd's systemd-resolved ip address of 127.0.0.53 in /etc/resolv.conf SystemdPath = "/run/systemd/resolve/resolv.conf" )
var DefaultNameservers = []string{
"8.8.8.8",
"8.8.4.4",
"2001:4860:4860::8888",
"2001:4860:4860::8844",
}
Note: the default IPv4 & IPv6 resolvers are set to Google's Public DNS This follows Docker's and nerdctl's default behavior.
These are only used if the host's resolv.conf is not available or the name server is localhost.
Functions ¶
Types ¶
type Config ¶
Config is a parsed resolv.conf file.
func DefaultResolvConf ¶
func DefaultResolvConf() *Config
DefaultResolvConf returns a default resolv.conf using `DefaultNameservers`.
func FromHost ¶
FromHost parses and returns the host's resolv.conf. If it detects systemd's systemd-resolved ip address it will use systemd's resolv.conf instead.
Additionally, it filters out any loopback addresses as it is assumed that this Config will be used in a container and containers may not be able to use loopback addresses.
func (*Config) FilterLoopback ¶
func (rc *Config) FilterLoopback()
FilterLoopback filters out any loopback addresses because it is assumed that this Config will be used in a container and containers may not be able to use loopback addresses.