Discover Packages
github.com/jahkeup/testacme
pkg
randomports
package
Version:
v0.0.0-...-e9f60da
Opens a new window with list of versions in this module.
Published: Feb 21, 2023
License: GPL-3.0
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package randomports provides helpers to get random, free port numbers for
testing listener use cases.
Reserve puts the port into a shared cache. When the port exist, false is
returned (as in it could not reserve the port for you to vend).
Two provides a set of ports. For convenience.
Port holds a port number value. This type provides a convenient handle on
that port number across a few different use cases.
One provides a single port. For convenience.
RandomPorts returns a list of port numbers that are safe-to-assume to be free. An
internal list is used track vended ports to avoid concurrent users from
seeing conflicting ports.
Int returns the port as an int.
Must is a builder style conditional that can be used to ensure (by panic)
that a port number is given (ie: not 0).
String prints the port number as a string.
Uint returns the port as an uint.
Uint16 returns the port as an uint16.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.