package
Version:
v1.1.3
Opens a new window with list of versions in this module.
Published: Jan 23, 2022
License: Apache-2.0
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Nettest
This package provides a simple way to get an open TCP/UDP port that can then be used for testing.
Example Usage
port := nettest.GetTCP()
address := net.JoinHostPort("0.0.0.0", strconv.Itoa(port))
listener, err := net.Listen("tcp", address)
if err != nil {
return err
}
rpc.Accept(listener)
Documentation
¶
Package nettest please refer to README.md
GetTCP returns a TCP port that is available for use.
NOTE: in the very rare case when no ports are available, this method will panic
GetUDP returns a UDP port that is available for use.
NOTE: in the very rare case when no ports are available, this method will panic
Source Files
¶
Click to show internal directories.
Click to hide internal directories.