Documentation ¶
Index ¶
- Variables
- func DHCPAllAllocations(network string) (map[[4]byte]DHCPAllocation, map[[16]byte]DHCPAllocation, error)
- func DHCPStaticAllocation(network string, deviceStaticFileName string) (net.HardwareAddr, DHCPAllocation, DHCPAllocation, error)
- func DHCPStaticAllocationPath(network string, deviceStaticFileName string) string
- func GetVersion() (*version.DottedVersion, error)
- func Kill(name string, reload bool) error
- func RemoveStaticEntry(network string, projectName string, instanceName string, deviceName string) error
- func StaticAllocationFileName(projectName string, instanceName string, deviceName string) string
- func UpdateStaticEntry(network string, projectName string, instanceName string, deviceName string, ...) error
- type DHCPAllocation
Constants ¶
This section is empty.
Variables ¶
var ConfigMutex sync.Mutex
ConfigMutex used to coordinate access to the dnsmasq config files.
Functions ¶
func DHCPAllAllocations ¶
func DHCPAllAllocations(network string) (map[[4]byte]DHCPAllocation, map[[16]byte]DHCPAllocation, error)
DHCPAllAllocations returns a map of IPs currently allocated (statically and dynamically) in dnsmasq for a specific network. The returned map is keyed by a 16 byte array representing the net.IP format. The value of each map item is a DHCPAllocation struct containing at least whether the allocation was static or dynamic and optionally instance name or MAC address. MAC addresses are only included for dynamic IPv4 allocations (where name is not reliable). Static allocations are not overridden by dynamic allocations, allowing for instance name to be included for static IPv6 allocations. IPv6 addresses that are dynamically assigned cannot be reliably linked to instances using either name or MAC because dnsmasq does not record the MAC address for these records, and the recorded host name can be set by the instance if the dns.mode for the network is set to "dynamic" and so cannot be trusted, so in this case we do not return any identifying info.
func DHCPStaticAllocation ¶
func DHCPStaticAllocation(network string, deviceStaticFileName string) (net.HardwareAddr, DHCPAllocation, DHCPAllocation, error)
DHCPStaticAllocation retrieves the dnsmasq statically allocated MAC and IPs for an instance device static file. Returns MAC, IPv4 and IPv6 DHCPAllocation structs respectively.
func DHCPStaticAllocationPath ¶
DHCPStaticAllocationPath returns the path to the DHCP static allocation file.
func GetVersion ¶
func GetVersion() (*version.DottedVersion, error)
GetVersion returns the version of dnsmasq.
func RemoveStaticEntry ¶
func RemoveStaticEntry(network string, projectName string, instanceName string, deviceName string) error
RemoveStaticEntry removes a single dhcp-host line for a network/instance combination.
func StaticAllocationFileName ¶
StaticAllocationFileName returns the file name to use for a dnsmasq instance device static allocation.
Types ¶
type DHCPAllocation ¶
type DHCPAllocation struct { IP net.IP StaticFileName string MAC net.HardwareAddr }
DHCPAllocation represents an IP allocation from dnsmasq.