ipaddr

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAddressPoolNotAvailable = errors.New("address pool not Available")
	ErrAddressOutOfRange       = errors.New("address out of range")
	ErrAddressInUse            = errors.New("address in use")
)

Functions

This section is empty.

Types

type PoolV4

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

func NewPool

func NewPool(cidr string) (p *PoolV4, err error)

NewPool constructor

func (*PoolV4) Available

func (p *PoolV4) Available() bool

Available shows pool is available

func (*PoolV4) Get

func (p *PoolV4) Get(ip string) (addr string, err error)

Get ip address from pool

func (*PoolV4) GetRandom

func (p *PoolV4) GetRandom() (string, error)

GetRandom return an address if available

func (*PoolV4) Put

func (p *PoolV4) Put(ip string) error

Put ip back to current pool

func (*PoolV4) Size

func (p *PoolV4) Size() uint32

Size pool size

func (*PoolV4) Used

func (p *PoolV4) Used() int

Used number of address

Jump to

Keyboard shortcuts

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