port

package
v0.37.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NameDelimiter = "_"
)

Variables

This section is empty.

Functions

func GenName

func GenName(name string, options ...NameOption) string

Types

type Allocator

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

func NewAllocator

func NewAllocator(from int, to int, mod int, index int) *Allocator

NewAllocator return a port allocator for testing. Example: from: 10, to: 20, mod 4, index 1 Reserved ports: 13, 17

func (*Allocator) Get

func (pa *Allocator) Get() int

func (*Allocator) GetByName

func (pa *Allocator) GetByName(portName string) int

func (*Allocator) Release

func (pa *Allocator) Release(port int)

type NameOption

type NameOption func(*nameBuilder) *nameBuilder

func WithRangePorts

func WithRangePorts(from, to int) NameOption

Jump to

Keyboard shortcuts

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