port

package
v0.61.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 14

Documentation

Index

Constants

View Source
const (
	NameDelimiter = "_"
)

Variables

This section is empty.

Functions

func GenName added in v0.37.0

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 added in v0.37.0

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

func (*Allocator) Release

func (pa *Allocator) Release(port int)

type NameOption added in v0.37.0

type NameOption func(*nameBuilder) *nameBuilder

func WithRangePorts added in v0.37.0

func WithRangePorts(from, to int) NameOption

Jump to

Keyboard shortcuts

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