network

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConnectionToHost

func CheckConnectionToHost(ctx context.Context, targetURL url.URL, opts ...ConnectionOption) error

CheckConnectionToHost checks if a connection can be established to the host specified in the URL.

Types

type ConnectionOption added in v1.0.7

type ConnectionOption func(*ConnectionOptions)

func WithProxyFunc added in v1.0.7

func WithProxyFunc(f func(*url.URL) (*url.URL, error)) ConnectionOption

this is overridable mainly for testing purposes to avoid using environment variables to manipulate the proxy environment and because the default ProxyFunc always skips the proxy for localhost/loopback addresses, it does not require that they be listed in the NO_PROXY environment variable. This makes testing difficult since we would need to manipulate the dns resolution on the test machine (ex: modify /etc/hosts).

type ConnectionOptions added in v1.0.7

type ConnectionOptions struct {
	// ProxyFunc determines which proxy to use for a given request.
	// If nil, uses httpproxy.FromEnvironment().ProxyFunc()
	ProxyFunc func(*url.URL) (*url.URL, error)
}

Jump to

Keyboard shortcuts

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