Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNameServersFromResolveConfig ¶
GetNameServersFromResolveConfig parses a file in the format of /etc/resolv.conf The resolve.conf format is described in resolv.conf(5):
https://man7.org/linux/man-pages/man5/resolv.conf.5.html
This function looks up at the lines starting with `nameserver`. There can be a single nameserver each line and maximum 3 (defined my MAXNS in resolv.h) in the file.
func GetSystemResolvers ¶
func GetSystemResolvers() []string
GetSystemResolvers returns resolvers discovered via /etc/resolv.conf. If not valid resolvers are found, an empty array is returned.
func ParseNameServers ¶
ParseNameServers parses an array of bytes and returns the nameservers The content should be of format of /etc/resolv.conf i.e. nameserver 12.0.0.3
Types ¶
type Manager ¶
type Manager struct { Config interface{} // contains filtered or unexported fields }
Manager - configuration manager for the service
This manager is multiple goroutines safe. Multiple goroutines can use one of these objects, and data updates are performed asynchronously. When an update function is pushed onto a channel, a single goroutine handles the update. When an update occurs the data is written to the config file. Read access is synchronous, where there is some time between seeing updates to the data. This is patterned after Akka's Agents (https://doc.akka.io/docs/akka/2.5.6/java/agents.html)
func NewManager ¶
NewManager - create a new config. There should only be one config for the service.
func (*Manager) Close ¶
func (manager *Manager) Close()
Close - to close out the channel for this object. This should only be called when the service is being shutdown
func (*Manager) UpdateConfig ¶
UpdateConfig - update the config