safehttp

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package safehttp builds HTTP clients that reject private and reserved network destinations.

Index

Constants

This section is empty.

Variables

View Source
var ErrPrivateNetwork = errors.New("storage: private / local network address disallowed")

ErrPrivateNetwork is returned when a guarded client refuses to dial a private, local, multicast, unspecified, or reserved network address. Its text preserves the established storage.ErrPrivateNetwork error string.

Functions

func NewClient

func NewClient(timeout time.Duration, allowPrivate bool) *http.Client

NewClient returns an HTTP client whose transport resolves each target once and dials the accepted IP directly. Environment-variable proxies are disabled. When allowPrivate is false, private and reserved destinations are rejected with ErrPrivateNetwork.

Types

This section is empty.

Jump to

Keyboard shortcuts

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