Documentation
¶
Index ¶
- type Calculator
- func (c *Calculator) AddAllocatedPrefix(prefix netip.Prefix)
- func (c *Calculator) AddPool(prefix netip.Prefix)
- func (c *Calculator) DeleteAllocatedPrefix(prefix netip.Prefix)
- func (c *Calculator) DeletePool(prefix netip.Prefix)
- func (c *Calculator) NextAvailableIPv4Subnet(numBits int) (netip.Prefix, error)
- func (c *Calculator) NextAvailableIPv6Subnet(numBits int) (netip.Prefix, error)
- func (c *Calculator) PrefixInPools(prefix netip.Prefix) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Calculator ¶
type Calculator struct { IPv4Pools *iradix.Tree AllocatedIPv4Prefixes *iradix.Tree IPv6Pools *iradix.Tree AllocatedIPv6Prefixes *iradix.Tree }
Calculator stores radix trees of supernets and subnets.
func NewCalculator ¶
func NewCalculator() *Calculator
NewCalculator creates a new Calculator from a list of supernets and subnets.
func (*Calculator) AddAllocatedPrefix ¶
func (c *Calculator) AddAllocatedPrefix(prefix netip.Prefix)
func (*Calculator) AddPool ¶
func (c *Calculator) AddPool(prefix netip.Prefix)
func (*Calculator) DeleteAllocatedPrefix ¶
func (c *Calculator) DeleteAllocatedPrefix(prefix netip.Prefix)
func (*Calculator) DeletePool ¶
func (c *Calculator) DeletePool(prefix netip.Prefix)
func (*Calculator) NextAvailableIPv4Subnet ¶ added in v0.3.0
func (c *Calculator) NextAvailableIPv4Subnet(numBits int) (netip.Prefix, error)
NextAvailableIPv4Subnet finds the first available IPv4 subnet of a given mask length from a list of subnets and supernets, and fails if none are available.
func (*Calculator) NextAvailableIPv6Subnet ¶ added in v0.3.0
func (c *Calculator) NextAvailableIPv6Subnet(numBits int) (netip.Prefix, error)
NextAvailableIPv6Subnet finds the first available IPv6 subnet of a given mask length from a list of subnets and supernets, and fails if none are available.
func (*Calculator) PrefixInPools ¶
func (c *Calculator) PrefixInPools(prefix netip.Prefix) bool
PrefixInPools tests to see if a prefix is a part of any pools that have been added to the calculator.
Click to show internal directories.
Click to hide internal directories.