cidrset

package
v0.0.0-...-8a55389 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCIDRRangeNoCIDRsRemaining occurs when there are 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")
)

Functions

This section is empty.

Types

type CidrSet

type CidrSet struct {
	sync.Mutex
	// contains filtered or unexported fields
}

CidrSet manages a set of CIDR ranges from which blocks of IPs can be allocated from.

func NewCIDRSet

func NewCIDRSet(clusterCIDR *net.IPNet, subNetMaskSize int) *CidrSet

NewCIDRSet creates a new CidrSet.

func (*CidrSet) AllocateNext

func (s *CidrSet) AllocateNext() (*net.IPNet, error)

AllocateNext allocates the next free CIDR range.

func (*CidrSet) Occupy

func (s *CidrSet) Occupy(cidr *net.IPNet) (err error)

Occupy marks the given CIDR range as used.

func (*CidrSet) Release

func (s *CidrSet) Release(cidr *net.IPNet) error

Release releases the given CIDR range.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL