ports

package
v5.0.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllocateMachinePort

func AllocateMachinePort() (int, error)

Reserves a unique port for a machine instance in a global (user) scope across all machines and backend types. On success the port is guaranteed to not be allocated until released with a call to ReleaseMachinePort().

The purpose of this method is to prevent collisions between machine instances when ran at the same time. Note, that dynamic port reassignment on its own is insufficient to resolve conflicts, since there is a narrow window between port detection and actual service binding, allowing for the possibility of a second racing machine to fail if its check is unlucky to fall within that window. Additionally, there is the potential for a long running reassignment dance over start/stop until all machine instances eventually arrive at total conflict free state. By reserving ports using mechanism these scenarios are prevented.

func IsLocalPortAvailable

func IsLocalPortAvailable(port int) bool

func ReleaseMachinePort

func ReleaseMachinePort(port int) error

Releases a reserved port for a machine when no longer required. Care should be taken to ensure there are no conditions (e.g. failure paths) where the port might unintentionally remain in use after releasing

Types

This section is empty.

Jump to

Keyboard shortcuts

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