Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDHCPNotSupported error = errors.New("Network doesn't support DHCP")
ErrDHCPNotSupported indicates network doesn't support DHCP for this IP protocol.
Functions ¶
func AllocateTask ¶
func AllocateTask(opts *Options, f func(*Transaction) error) error
AllocateTask initialises a new locked Transaction for a specific host and executes the supplied function on it. The lock on the dnsmasq config is released when the function returns.
func DHCPValidIP ¶
DHCPValidIP returns whether an IP fits inside one of the supplied DHCP ranges and subnet.
Types ¶
type Network ¶
type Network interface { Name() string Type() string Config() map[string]string DHCPv4Subnet() *net.IPNet DHCPv6Subnet() *net.IPNet DHCPv4Ranges() []shared.IPRange DHCPv6Ranges() []shared.IPRange }
Network represents a LXD network responsible for running dnsmasq.
type Options ¶
type Options struct { ProjectName string HostName string HostMAC net.HardwareAddr Network Network }
Options to initialise the allocator with.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction is a locked transaction of the dnsmasq config files that allows IP allocations for a host.
func (*Transaction) AllocateIPv4 ¶
func (t *Transaction) AllocateIPv4() (net.IP, error)
AllocateIPv4 allocate an IPv4 static DHCP allocation.
func (*Transaction) AllocateIPv6 ¶
func (t *Transaction) AllocateIPv6() (net.IP, error)
AllocateIPv6 allocate an IPv6 static DHCP allocation.