Versions in this module Expand all Collapse all v1 v1.16.3 Nov 9, 2022 Changes in this version + var ErrAllocated = errors.New("provided port is already allocated") + var ErrFull = errors.New("range is full") + var ErrMismatchedNetwork = errors.New("the provided port range does not match the current port range") + type ErrNotInRange struct + ValidPorts string + func (e *ErrNotInRange) Error() string + type Interface interface + Allocate func(int) error + AllocateNext func() (int, error) + ForEach func(func(int)) + Has func(int) bool + Release func(int) error + type PortAllocationOperation struct + func StartOperation(pa Interface, dryRun bool) *PortAllocationOperation + func (op *PortAllocationOperation) Allocate(port int) error + func (op *PortAllocationOperation) AllocateNext() (int, error) + func (op *PortAllocationOperation) Commit() []error + func (op *PortAllocationOperation) Finish() + func (op *PortAllocationOperation) ReleaseDeferred(port int) + func (op *PortAllocationOperation) Rollback() []error + type PortAllocator struct + func NewFromSnapshot(snap *api.RangeAllocation) (*PortAllocator, error) + func NewPortAllocator(pr net.PortRange) (*PortAllocator, error) + func NewPortAllocatorCustom(pr net.PortRange, allocatorFactory allocator.AllocatorFactory) (*PortAllocator, error) + func (r *PortAllocator) Allocate(port int) error + func (r *PortAllocator) AllocateNext() (int, error) + func (r *PortAllocator) ForEach(fn func(int)) + func (r *PortAllocator) Free() int + func (r *PortAllocator) Has(port int) bool + func (r *PortAllocator) Release(port int) error + func (r *PortAllocator) Restore(pr net.PortRange, data []byte) error + func (r *PortAllocator) Snapshot(dst *api.RangeAllocation) error + func (r *PortAllocator) Used() int