netutil

package
v0.83.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAvailability

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)

func IsLocalhost

func IsLocalhost(host string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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