port

package
v0.0.0-...-dd907ac Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 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