portm

package
v0.2.2-rc4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

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