Documentation ¶
Overview ¶
Package dnsclientconf provides a portable interface for operating system dns client settings.
Index ¶
Constants ¶
const ( ResolvConfigPath = "/etc/resolv.conf" DhclientConfigPath = "/etc/dhcp/dhclient.conf" DhclientConfigPathBackup = "/etc/dhcp/dhclient.conf.auto" InterfaceName = "" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DNSConfigurator ¶
type DNSConfigurator interface { GetNameServers() ([]net.IP, error) AddNameServers(addrs []net.IP) error DHCPNameServers() error ReloadNameServers() error SetInterface(iface *net.Interface) }
DNSConfigurator is the interface that wraps the NameServers methods. In most cases all methods need Administrator priviledges(except GetNameServers).
GetNameServers is the method that returns the list of host dns addresses. Side effect free.
AddNameServers reads the list of ip addresses and changes host operating system dns settings. If you want cancel this method effect, please call DHCPNameServers.
DHCPNameServers is the method that revert previously configured name servers addresses. Generally applies dhcp protocol.
ReloadNameServers is the method that safety refresh dns settings.
func NewDNSConfigurator ¶
func NewDNSConfigurator() DNSConfigurator