freeport

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package freeport provides a helper for allocating free ports across multiple processes on the same machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Free

func Free(n int) (ports []int, err error)

Free returns a list of free ports from the allocated port block. It is safe to call this method concurrently. Ports have been tested to be available on 127.0.0.1 TCP but there is no guarantee that they will remain free in the future.

func Get

func Get(n int) (ports []int)

Get wraps the Free function and panics on any failure retrieving ports.

func GetT

func GetT(t testing.T, n int) (ports []int)

GetT is suitable for use when retrieving unused ports in tests. If there is an error retrieving free ports, the test will be failed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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