Documentation
¶
Overview ¶
Package networking provides utilities for network operations, such as finding available ports and checking network connectivity.
Index ¶
Constants ¶
const ( // MinPort is the minimum port number to use MinPort = 10000 // MaxPort is the maximum port number to use MaxPort = 65535 // MaxAttempts is the maximum number of attempts to find an available port MaxAttempts = 10 )
const HttpTimeout = 30 * time.Second
HttpTimeout is the timeout for outgoing HTTP requests
Variables ¶
This section is empty.
Functions ¶
func FindOrUsePort ¶
FindOrUsePort checks if the provided port is available or finds an available port if none is provided. If port is 0, it will find an available port. If port is not 0, it will check if the port is available. Returns the selected port and an error if any.
func GetProtectedHttpClient ¶ added in v0.0.37
GetProtectedHttpClient returns a new http client with a protected dialer and URL validation
func IsIPv6Available ¶
func IsIPv6Available() bool
IsIPv6Available checks if IPv6 is available on the system by looking for IPv6 addresses on network interfaces
Types ¶
type ValidatingTransport ¶ added in v0.0.37
type ValidatingTransport struct {
Transport http.RoundTripper
}
ValidatingTransport is for validating URLs prior to request