portm

package
v0.6.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoFreePort = errors.New("no free port find")

ErrNoFreePort is returned when trying to reserve a port but all the the port of the range have been already reserved

Functions

This section is empty.

Types

type Allocator

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

Allocator implements the PortAllocator interface

func NewAllocator

func NewAllocator(pRange PortRange, store backend.Store) *Allocator

NewAllocator return a PortAllocator

func (*Allocator) Release

func (a *Allocator) Release(ns string, port int) error

Release implements PortAllocator interface

func (*Allocator) Reserve

func (a *Allocator) Reserve(ns string) (int, error)

Reserve implements PortAllocator interface

type PortAllocator

type PortAllocator interface {
	Reserve(ns string) (int, error)
	Release(ns string, port int) error
}

PortAllocator is the interface that defines the behavior to reserve a port in a specific network namespace

type PortRange

type PortRange struct {
	Start int
	End   int
}

PortRange hold the beginging and end of a range of port a PortAllocator can reserve

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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