net

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package net contains network-related helpers for integration testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePort

func GeneratePort(address string) (string, int, error)

GeneratePort takes the address in the string provided and updates the port to one that is open. Returns the complete address, the chosen port, and the error, if any.

func GetAvailablePort

func GetAvailablePort() (int, error)

GetAvailablePort retrieves an available port on the host machine. This delegates the port selection to the golang net library by starting a server and then checking the port that the server is using.

func MaybeGeneratePort

func MaybeGeneratePort(address string) (string, int, bool, error)

MaybeGeneratePort takes an address and generates a new version of that address with the port replaced with an open port if the original port was 0. Otherwise, the address is returned unchanged. This method returns the potentially updated address, the potentially updated port, a boolean indicating if the address was changed, and an error in case the method failed

Types

This section is empty.

Jump to

Keyboard shortcuts

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