Versions in this module Expand all Collapse all v0 v0.0.41 Aug 19, 2026 v0.0.40 Aug 13, 2026 v0.0.39 Aug 11, 2026 Changes in this version + const HttpScheme + const HttpTimeout + const HttpsScheme + const MaxAttempts + const MaxPort + const MaxRedirects + const MinPort + var ErrPrivateIPAddress = errors.New("the provided URL redirects to a private IP address, which is not allowed") + var ErrRedirectRefused = errors.New("redirect refused") + func AddressReferencesPrivateIp(address string) error + func FindAvailable() int + func FindAvailableListener() (*net.TCPListener, error) + func FindOrUseListener(port int) (*net.TCPListener, error) + func FindOrUsePort(port int) (int, error) + func GetProcessOnPort(port int) (int, error) + func IsAvailable(port int) bool + func IsHTTPError(err error, statusCode int) bool + func IsLocalhost(host string) bool + func IsLoopbackHost(host string) bool + func IsPreRegisteredClient(clientID string) bool + func IsPrivateIP(ip net.IP) bool + func IsURL(input string) bool + func NewHTTPError(statusCode int, url, message string) error + func NewPrivateIPBlockingDialContext() func(ctx context.Context, network, addr string) (net.Conn, error) + func ParsePortSpec(portSpec string) (string, int, error) + func SameHostRedirectPolicy() func(req *http.Request, via []*http.Request) error + func TargetIsPrivate(ctx context.Context, rawURL string) bool + func ValidateCallbackPort(callbackPort int, clientID string) error + func ValidateEndpointURL(endpoint string) error + func ValidateEndpointURLWithInsecure(endpoint string, insecureAllowHTTP bool) error + func ValidateEndpointURLWithInsecureAndReader(endpoint string, insecureAllowHTTP bool, reader env.Reader) error + func ValidateEndpointURLWithReader(endpoint string, reader env.Reader) error + func ValidateHTTPSURL(rawURL string) error + func ValidateIssuerURL(rawURL string) error + func ValidateLoopbackAddress(addr string) error + type FetchOption func(*fetchOptions) + func WithBody(body io.Reader) FetchOption + func WithErrorHandler(handler func(*http.Response, []byte) error) FetchOption + func WithHeader(key, value string) FetchOption + func WithMaxResponseSize(size int64) FetchOption + func WithMethod(method string) FetchOption + type FetchResult struct + Data T + Headers http.Header + func FetchJSONWithForm[T any](ctx context.Context, client HTTPClient, requestURL string, formData url.Values, ...) (*FetchResult[T], error) + func FetchJSON[T any](ctx context.Context, client HTTPClient, requestURL string, opts ...FetchOption) (*FetchResult[T], error) + type HTTPClient interface + Do func(req *http.Request) (*http.Response, error) + type HTTPError struct + Message string + StatusCode int + URL string + func (e *HTTPError) Error() string + type HttpClientBuilder struct + func NewHostScopedClientBuilder(host string, allowPrivateIPs, insecureAllowHTTP bool) *HttpClientBuilder + func NewHostScopedClientBuilderWithReader(host string, allowPrivateIPs, insecureAllowHTTP bool, reader env.Reader) *HttpClientBuilder + func NewHttpClientBuilder() *HttpClientBuilder + func (b *HttpClientBuilder) Build() (*http.Client, error) + func (b *HttpClientBuilder) WithCABundle(path string) *HttpClientBuilder + func (b *HttpClientBuilder) WithEnvReader(reader env.Reader) *HttpClientBuilder + func (b *HttpClientBuilder) WithInsecureAllowHTTP(allow bool) *HttpClientBuilder + func (b *HttpClientBuilder) WithPrivateIPs(allow bool) *HttpClientBuilder + func (b *HttpClientBuilder) WithTimeout(timeout time.Duration) *HttpClientBuilder + func (b *HttpClientBuilder) WithTokenFromFile(path string) *HttpClientBuilder + type ValidatingTransport struct + EnvReader env.Reader + InsecureAllowHTTP bool + Transport http.RoundTripper + func (t *ValidatingTransport) RoundTrip(req *http.Request) (*http.Response, error)