Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FreePort ¶ added in v0.304.0
FreePort attempts to request from the OS an available local free port for a given network type.
Be careful, as it might take a bit time to have the port fully released before you can use it to initiate a new connection
func GetFreePort
deprecated
func IsPortFree ¶
IsPortFree checks if a given TCP port is free to bind to. It takes into account specifics of
MacOS behavior where multiple IP versions (IPv4 and IPv6) may be bound to the same port, which can lead to false positives in port availability checking. IsPortFree able to work this around by checking both ip versions for the port, to give a unified behaviour across different platforms.
If you wish to check both TCP and UDP networks, then give a zero value to the Network argument.