Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyPort = errors.New("port cannot be empty") ErrInvalidFormat = errors.New("invalid port format") ErrPortOutOfRange = errors.New("port number must be between 1 and 65535") )
Common port validation errors
Functions ¶
func GetRandomListeningPort ¶ added in v0.0.5
GetRandomListeningPort finds an available port for a test by binding to port 0, and returns a string like localhost:PORT
func GetRandomPort ¶ added in v0.0.5
GetRandomPort finds an available port for a test by binding to port 0
func ValidatePort ¶
ValidatePort checks if the provided port string is valid and returns a normalized version. It accepts formats like ":8080", "localhost:8080", "127.0.0.1:8080", or "8080". Returns the normalized port format (":PORT") and an error if the port is invalid.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.