ipam

package
v0.0.0-...-735b8cc Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Start *big.Int
	End   *big.Int
	Mask  net.IPMask
	// contains filtered or unexported fields
}

func NewBlock

func NewBlock(ipCIDR, start, end string) (*Block, error)

func (*Block) Allocate

func (b *Block) Allocate(ipReq net.IP) (*net.IPNet, error)

Allocate one ip address from this block, if `ipReq` is not empty, will allocate one ip address not used in sequence

func (*Block) Contains

func (b *Block) Contains(ip net.IP) bool

func (*Block) Overlapped

func (b *Block) Overlapped(another *Block) bool

func (*Block) PutBack

func (b *Block) PutBack(ip net.IP) bool

type IPAddressManager

type IPAddressManager struct {
	// contains filtered or unexported fields
}

func NewIPAddressManager

func NewIPAddressManager() *IPAddressManager

func (*IPAddressManager) AddAddressBlock

func (m *IPAddressManager) AddAddressBlock(cidr, start, end string) error

AddAddressBlock adds one block allocation pool

func (*IPAddressManager) Allocate

func (m *IPAddressManager) Allocate(ipReq net.IP) (*net.IPNet, error)

Allocate one ip address from blocks, if `ipReq` is nil, will try to allocate a ip address from blocks in sequence

func (*IPAddressManager) Check

func (m *IPAddressManager) Check(ip string)

Check if ip is managed

func (*IPAddressManager) PutBack

func (m *IPAddressManager) PutBack(ip net.IP)

PutBack one ip address

Jump to

Keyboard shortcuts

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