Documentation
¶
Overview ¶
Package outbound provides controlled clients for outbound HTTP calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstrumentTransport ¶
func InstrumentTransport(base http.RoundTripper) http.RoundTripper
InstrumentTransport adds bounded HTTP client spans and metrics without changing the base transport's security, timeout or redirect policy. A nil transport uses http.DefaultTransport; wrapping its own result is idempotent. It propagates only W3C trace context, never baggage or incoming trace headers. Ordinary spans end at response-body EOF/Close; an HTTP 101 span ends at the handshake and leaves the upgraded bidirectional body unchanged.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a reusable HTTP client without exposing mutable security policy.
func NewClient ¶
NewClient builds a client with TLS verification, HTTP(S)-only requests, redirect refusal, and bounded telemetry. It adds no application-level retries; standard library transport behavior is otherwise unchanged.
func (*Client) CloseIdleConnections ¶
func (c *Client) CloseIdleConnections()
CloseIdleConnections releases pooled connections owned by this client.
type HTTPConfig ¶
type HTTPConfig struct {
Timeout time.Duration `koanf:"timeout" yaml:"timeout"`
DialTimeout time.Duration `koanf:"dial_timeout" yaml:"dial_timeout"`
TLSHandshakeTimeout time.Duration `koanf:"tls_handshake_timeout" yaml:"tls_handshake_timeout"`
ResponseHeaderTimeout time.Duration `koanf:"response_header_timeout" yaml:"response_header_timeout"`
IdleConnTimeout time.Duration `koanf:"idle_conn_timeout" yaml:"idle_conn_timeout"`
MaxIdleConns int `koanf:"max_idle_conns" yaml:"max_idle_conns"`
MaxIdleConnsPerHost int `koanf:"max_idle_conns_per_host" yaml:"max_idle_conns_per_host"`
MaxConnsPerHost int `koanf:"max_conns_per_host" yaml:"max_conns_per_host"`
}
HTTPConfig is the shared YAML-decodable HTTP connection budget for outbound, unary contract, SSE and WebSocket clients. Zero fields retain standard-library transport defaults. Timeout bounds the entire HTTP response body; leave it zero for streams and use their explicit stream budgets instead. Credentials and TLS trust are supplied separately by trusted application code, never by this config.
func (HTTPConfig) HTTPClient ¶
func (cfg HTTPConfig) HTTPClient() (*http.Client, error)
HTTPClient constructs an independent standard transport for an adapter to validate and instrument. Pass the result to SecureClientOptions.HTTPClient or a generated client; this configuration-only helper does not add credentials, instrumentation or redirect policy. Trusted TLS roots can be set on its *http.Transport before handing it to an adapter. Callers must close idle connections when the client is no longer used.