Documentation ¶
Index ¶
- Variables
- type CidrSet
- func (s *CidrSet) AllocateNext() (*net.IPNet, error)
- func (s *CidrSet) InRange(cidr *net.IPNet) bool
- func (s *CidrSet) IsAllocated(cidr *net.IPNet) (bool, error)
- func (s *CidrSet) IsClusterCIDR(cidr netip.Prefix) bool
- func (s *CidrSet) IsFull() bool
- func (s *CidrSet) Occupy(cidr *net.IPNet) (err error)
- func (s *CidrSet) Prefix() netip.Prefix
- func (s *CidrSet) Release(cidr *net.IPNet) error
- func (s *CidrSet) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrCIDRRangeNoCIDRsRemaining occurs when there is no more space // to allocate CIDR ranges. ErrCIDRRangeNoCIDRsRemaining = errors.New( "CIDR allocation failed; there are no remaining CIDRs left to allocate in the accepted range") // ErrCIDRSetSubNetTooBig occurs when the subnet mask size is too // big compared to the CIDR mask size. ErrCIDRSetSubNetTooBig = errors.New( "New CIDR set failed; the node CIDR size is too big") // ErrSubNetMaskSizeInvalid occurs when the subnet mask size is invalid: // bigger than 32 for IPv4 and bigger than 128 for IPv6 ErrSubNetMaskSizeInvalid = fmt.Errorf( "SubNetMask is invalid, should be lower or equal to %d for IPv4 and to %d for IPv6", maxSubNetMaskSizeIPv4, maxSubNetMaskSizeIPv6) )
Functions ¶
This section is empty.
Types ¶
type CidrSet ¶
CidrSet manages a set of CIDR ranges from which blocks of IPs can be allocated from.
func NewCIDRSet ¶
NewCIDRSet creates a new CidrSet.
func (*CidrSet) AllocateNext ¶
AllocateNext allocates the next free CIDR range. This will set the range as occupied and return the allocated range.
func (*CidrSet) InRange ¶
InRange returns true if the given CIDR is inside the range of the allocatable CidrSet.
func (*CidrSet) IsAllocated ¶
IsAllocated verifies if the given CIDR is allocated
func (*CidrSet) IsClusterCIDR ¶
IsClusterCIDR returns true if the given CIDR is equal to this CidrSet's cluster CIDR.
func (*CidrSet) Occupy ¶
Occupy marks the given CIDR range as used. Occupy succeeds even if the CIDR range was previously used.
Click to show internal directories.
Click to hide internal directories.