reserveport

package
v0.0.0-...-745cdaa Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PortManager

type PortManager interface {
	// ReservePort reserves a new port. The lifecycle of the returned port is transferred to the caller.
	ReservePort() (ReservedPort, error)
	ReservePortOrFail(t *testing.T) ReservedPort
	ReservePortNumber() (uint16, error)
	ReservePortNumberOrFail(t *testing.T) uint16
	// Close shuts down this manager and frees any associated resources.
	Close() error
	CloseSilently()
}

PortManager is responsible for reserving ports for an application.

func NewPortManager

func NewPortManager() (mgr PortManager, err error)

NewPortManager allocates a new PortManager

func NewPortManagerOrFail

func NewPortManagerOrFail(t *testing.T) PortManager

NewPortManagerOrFail calls NewPortManager and fails the test if unsuccessful.

type ReservedPort

type ReservedPort interface {
	// GetPort returns the bound port number.
	GetPort() uint16
	// Close unbinds this port.
	Close() error
	CloseSilently()
}

ReservedPort a port reserved by a PortManager

Jump to

Keyboard shortcuts

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