httpclient

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DataClient = NewDataClient()

DataClient is for fetching operator-configured data sources and posting to operator-configured destinations.

It bounds the phases that must be fast — connecting, the TLS handshake, and waiting for the server to begin its reply — but deliberately does not cap the total duration of a request. A data pipeline legitimately downloads large files and uploads large batches, and an overall Timeout would abort those on a clock rather than on a fault. This is the same distinction the API server makes between ReadHeaderTimeout and ReadTimeout: bound the wait, not the work.

It also deliberately performs NO SSRF check, which is what separates it from DefaultClient. Hermod is self-hosted, and a source pointed at http://internal-api.local is an ordinary thing to configure; refusing private addresses here would break the deployments this software exists for. Use DefaultClient instead whenever the thing being fetched is code, or comes from somewhere the operator does not control.

View Source
var DefaultClient = NewSecureClient(10 * time.Second)

DefaultClient is a pre-configured secure and performant HTTP client.

Functions

func Fetch

func Fetch(ctx context.Context, url string) (*http.Response, error)

Fetch performs a simple GET request with the default secure client.

func IsIPPrivate

func IsIPPrivate(ip net.IP) bool

IsIPPrivate reports whether the given IP address is in a private/local range.

func NewDataClient

func NewDataClient() *http.Client

NewDataClient builds the client described by DataClient.

func NewSecureClient

func NewSecureClient(timeout time.Duration) *http.Client

NewSecureClient returns an http.Client with reasonable timeouts and basic SSRF protection by preventing connections to local/private IP ranges.

func SafeDialer

func SafeDialer(network, address string, c syscall.RawConn) error

SafeDialer returns a dialer control function that rejects private IP addresses.

Types

This section is empty.

Jump to

Keyboard shortcuts

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