ports

package
v0.0.0-...-35b3a18 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocator

type Allocator interface {
	GetFreePort() (int, error)
}

Allocator is used to select port the app should listen on

type PredefinedPortAllocator

type PredefinedPortAllocator struct {
	ThePort int
}

PredefinedPortAllocator allows selecting concrete port to allocate

func (PredefinedPortAllocator) GetFreePort

func (allocaor PredefinedPortAllocator) GetFreePort() (int, error)

GetFreePort implements PortAllocator

type RandomPortAllocator

type RandomPortAllocator struct{}

RandomPortAllocator allocates random port

func (RandomPortAllocator) GetFreePort

func (allocator RandomPortAllocator) GetFreePort() (int, error)

GetFreePort implements PortAllocator

type RandomPortFromARangeAllocator

type RandomPortFromARangeAllocator struct {
	Min, Max int
}

RandomPortFromARangeAllocator returns random number from a range

func (RandomPortFromARangeAllocator) GetFreePort

func (allocator RandomPortFromARangeAllocator) GetFreePort() (int, error)

GetFreePort implements PortAllocator

Jump to

Keyboard shortcuts

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