Documentation ¶
Index ¶
- Constants
- type Server
- type ServersConfig
- func (d *ServersConfig) GetServersCache() []Server
- func (d *ServersConfig) GetServersCacheAndChannel() ([]Server, <-chan struct{})
- func (d *ServersConfig) RemoveAllServersWithNIC(nicID tcpip.NICID)
- func (d *ServersConfig) SetDefaultServers(servers []tcpip.Address)
- func (d *ServersConfig) UpdateDhcpServers(nicid tcpip.NICID, serverRefs *[]tcpip.Address)
- func (d *ServersConfig) UpdateNdpServers(servers []tcpip.FullAddress, lifetime time.Duration)
Constants ¶
const (
// DefaultDNSPort is the default port used by DNS servers.
DefaultDNSPort = 53
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { Address tcpip.FullAddress Source name.DnsServerSource }
/ Server is a DNS server with an address and configuration source.
type ServersConfig ¶
type ServersConfig struct {
// contains filtered or unexported fields
}
ServersConfig holds DNS resolvers' DNS servers configuration.
func MakeServersConfig ¶
func MakeServersConfig(clock tcpip.Clock) ServersConfig
func (*ServersConfig) GetServersCache ¶
func (d *ServersConfig) GetServersCache() []Server
GetServersCache returns a list of tcpip.FullAddress to DNS servers.
The expiring servers will be at the front of the list, followed by the runtime and default servers. The list will be deduplicated.
func (*ServersConfig) GetServersCacheAndChannel ¶
func (d *ServersConfig) GetServersCacheAndChannel() ([]Server, <-chan struct{})
GetServersCacheAndChannel returns a list of tcpip.FullAddress to DNS servers, and the receive end of a channel which will be closed when the list changes.
The expiring servers will be at the front of the list, followed by the runtime and default servers. The list will be deduplicated.
func (*ServersConfig) RemoveAllServersWithNIC ¶
func (d *ServersConfig) RemoveAllServersWithNIC(nicID tcpip.NICID)
RemoveAllServersWithNIC removes all servers associated with the specified NIC.
If a NIC is not specified (nicID == 0), then RemoveAllServersWithNIC does nothing.
func (*ServersConfig) SetDefaultServers ¶
func (d *ServersConfig) SetDefaultServers(servers []tcpip.Address)
SetDefaultServers sets the default list of nameservers to query. This usually comes from a system-wide configuration file. Servers are checked sequentially, in order. Takes ownership of the passed-in slice of addrs.
func (*ServersConfig) UpdateDhcpServers ¶
func (d *ServersConfig) UpdateDhcpServers(nicid tcpip.NICID, serverRefs *[]tcpip.Address)
UpdateDhcpServers updates the list of lists of runtime servers to query (e.g. collected from DHCP responses) referenced by a NICID. Servers are checked sequentially, in order.
Takes ownership of the passed-in list of serverRefs.
It's possible to introduce aliasing issues if a slice pointer passed here is obviated later but UpdateDhcpServers isn't called again.
E.g., if one of the network interface structs containing a slice pointer is deleted, UpdateDhcpServers should be called again with an updated list of runtime server refs.
func (*ServersConfig) UpdateNdpServers ¶
func (d *ServersConfig) UpdateNdpServers(servers []tcpip.FullAddress, lifetime time.Duration)
UpdateNdpServers updates the list of NDP-discovered servers to query.
If a server already known by c, its lifetime will be refreshed. If a server is not known and has a non-zero lifetime, it will be stored and set to expire after lifetime.
A lifetime value of less than 0 indicates that servers are not to expire (they will become valid forever until another update refreshes the lifetime).