nameserver

package
v2.0.0-rc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResolvPathIsDirectory = errors.New("resolv path is a directory")
)

Functions

func GetDNSServers

func GetDNSServers() (nameservers []netip.AddrPort)

func UseDNSInternally

func UseDNSInternally(settings SettingsInternalDNS)

UseDNSInternally changes the Go program DNS only.

func UseDNSSystemWide

func UseDNSSystemWide(settings SettingsSystemDNS) (err error)

UseDNSSystemWide changes the nameserver to use for DNS system wide. If resolvConfPath is empty, it defaults to /etc/resolv.conf.

Types

type SettingsInternalDNS

type SettingsInternalDNS struct {
	// IP is the IP address to use for the DNS.
	// It defaults to 127.0.0.1 if nil.
	IP netip.Addr
	// Port is the port to reach the DNS server on.
	// It defaults to 53 if left unset.
	Port uint16
	// Timeout is the dialer timeout. By default there is
	// no timeout.
	Timeout time.Duration
}

func (*SettingsInternalDNS) SetDefaults

func (s *SettingsInternalDNS) SetDefaults()

func (SettingsInternalDNS) Validate

func (s SettingsInternalDNS) Validate() (err error)

type SettingsSystemDNS

type SettingsSystemDNS struct {
	// IP is the IP address to use for the DNS.
	// It defaults to 127.0.0.1 if nil.
	IP netip.Addr
	// ResolvPath is the path to the resolv configuration file.
	// It defaults to /etc/resolv.conf.
	ResolvPath string
}

func (*SettingsSystemDNS) SetDefaults

func (s *SettingsSystemDNS) SetDefaults()

func (*SettingsSystemDNS) Validate

func (s *SettingsSystemDNS) Validate() (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL