package resolvconf
import "github.com/docker/docker/libnetwork/resolvconf"
Package resolvconf provides utility code to query and update DNS configuration in /etc/resolv.conf
Index ¶
- Constants
- func GetNameservers(resolvConf []byte, kind int) []string
- func GetNameserversAsPrefix(resolvConf []byte) []netip.Prefix
- func GetOptions(resolvConf []byte) []string
- func GetSearchDomains(resolvConf []byte) []string
- func Path() string
- type File
Constants ¶
const ( IP = iota // IPv4 and IPv6 IPv4 IPv6 )
constants for the IP address type
Functions ¶
func GetNameservers ¶
GetNameservers returns nameservers (if any) listed in /etc/resolv.conf
func GetNameserversAsPrefix ¶
GetNameserversAsPrefix returns nameservers (if any) listed in /etc/resolv.conf as CIDR blocks (e.g., "1.2.3.4/32")
func GetOptions ¶
GetOptions returns options (if any) listed in /etc/resolv.conf If more than one options line is encountered, only the contents of the last one is returned.
func GetSearchDomains ¶
GetSearchDomains returns search domains (if any) listed in /etc/resolv.conf If more than one search line is encountered, only the contents of the last one is returned.
func Path ¶
func Path() string
Types ¶
type File ¶
File contains the resolv.conf content and its hash
func Build ¶
Build generates and writes a configuration file to path containing a nameserver entry for every element in nameservers, a "search" entry for every element in dnsSearch, and an "options" entry for every element in dnsOptions. It returns a File containing the generated content and its (sha256) hash.
Note that the resolv.conf file is written, but the hash file is not.
func FilterResolvDNS ¶
FilterResolvDNS cleans up the config in resolvConf. It has two main jobs:
- It looks for localhost (127.*|::1) entries in the provided resolv.conf, removing local nameserver entries, and, if the resulting cleaned config has no defined nameservers left, adds default DNS entries
- Given the caller provides the enable/disable state of IPv6, the filter code will remove all IPv6 nameservers if it is not enabled for containers
func Get ¶
Get returns the contents of /etc/resolv.conf and its hash
func GetSpecific ¶
GetSpecific returns the contents of the user specified resolv.conf file and its hash
Source Files ¶
- Version
- v27.3.0-rc.2+incompatible
- Published
- Sep 18, 2024
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 41 minutes ago –
Tools for package owners.