freeport

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: MPL-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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