Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrSubnetNotFound = errors.New("subnet not found")
ErrSubnetNotFound is used to inform the subnet is not being managed
Functions ¶
Types ¶
type Allocator ¶
type Allocator interface { AddOrUpdateSubnet(name string, subnets []*net.IPNet, excludeSubnets ...*net.IPNet) error DeleteSubnet(name string) GetSubnets(name string) ([]*net.IPNet, error) AllocateUntilFull(name string) error AllocateIPPerSubnet(name string, ips []*net.IPNet) error AllocateNextIPs(name string) ([]*net.IPNet, error) ReleaseIPs(name string, ips []*net.IPNet) error ConditionalIPRelease(name string, ips []*net.IPNet, predicate func() (bool, error)) (bool, error) ForSubnet(name string) NamedAllocator GetSubnetName(subnets []*net.IPNet) (string, bool) }
Allocator manages the allocation of IP within specific set of subnets identified by a name. Allocator should be threadsafe.
type IPAllocator ¶
type IPAllocator struct {
// contains filtered or unexported fields
}
func (*IPAllocator) AllocateIPs ¶
func (ipAllocator *IPAllocator) AllocateIPs(ips []*net.IPNet) error
AllocateIPs allocates the requested IPs
func (*IPAllocator) AllocateNextIPs ¶
func (ipAllocator *IPAllocator) AllocateNextIPs() ([]*net.IPNet, error)
AllocateNextIPs allocates the next available IPs
func (*IPAllocator) ReleaseIPs ¶
func (ipAllocator *IPAllocator) ReleaseIPs(ips []*net.IPNet) error
ReleaseIPs release the provided IPs
Click to show internal directories.
Click to hide internal directories.