httpclient

package
v0.1.0-rc.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultTransport

func DefaultTransport() *http.Transport

DefaultTransport builds a shared transport policy for outbound HTTP from the composition root. It honors HTTP_PROXY / HTTPS_PROXY from the environment.

func NewTransport

func NewTransport(trustEnvironmentProxy bool) *http.Transport

NewTransport returns a new transport with the same tuning as DefaultTransport. When trustEnvironmentProxy is false, Proxy is nil so HTTP_PROXY and related env vars are ignored.

func NewTransportTune

func NewTransportTune(trustEnvironmentProxy bool, tune TransportTune) *http.Transport

NewTransportTune builds a transport from explicit tuning (see TransportTuneFromConfig for YAML-backed values).

func Standard

func Standard() *http.Client

Standard returns an HTTP client suitable for upstream provider calls from the standard bundle: explicit transport (timeouts, pooling), not package-global DefaultClient. It honors HTTP_PROXY / HTTPS_PROXY from the process environment.

func StandardWithTrustEnvironment

func StandardWithTrustEnvironment(trustEnv bool) *http.Client

StandardWithTrustEnvironment is like Standard but allows disabling use of proxy-related environment variables (sets Transport.Proxy to nil when trustEnv is false).

func StandardWithTune

func StandardWithTune(trustEnv bool, tune TransportTune) *http.Client

StandardWithTune builds a client using the given pooling and timeout tuning.

Types

type TransportTune

type TransportTune struct {
	MaxIdleConns          int
	MaxIdleConnsPerHost   int
	IdleConnTimeout       time.Duration
	ResponseHeaderTimeout time.Duration
	DialTimeout           time.Duration
	KeepAlive             time.Duration
	TLSHandshakeTimeout   time.Duration
	ExpectContinueTimeout time.Duration
	ClientTimeout         time.Duration
}

TransportTune holds outbound http.Transport and http.Client timeouts and pool sizes. Use DefaultTransportTune for the same defaults as historical Standard outbound behavior.

func DefaultTransportTune

func DefaultTransportTune() TransportTune

DefaultTransportTune matches the defaults used by Standard before optional YAML overrides.

func TransportTuneFromConfig

func TransportTuneFromConfig(cfg *config.Config) TransportTune

TransportTuneFromConfig overlays optional config.Config http_client fields on DefaultTransportTune. Invalid duration strings are ignored (callers should reject them in config.Validate first).

Jump to

Keyboard shortcuts

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