port

package
v0.0.87 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAvailability added in v0.0.84

func CheckAvailability(port int) bool

func GetFreePort

func GetFreePort(defaultPort int) (int, error)

GetFreePort returns a free port number. If the default port is not available, it will try to find a free port, checking at most the next 1024 ports. If no free port is found, it will get a random free port. If that fails, it will return the default port. If the default port is set to 0, 8080 will be used instead.

func GetRandomFreePort

func GetRandomFreePort() (port int, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL