Documentation
¶
Overview ¶
Package httpclient provides a centralized HTTP client factory with preset configurations.
Index ¶
Constants ¶
const ( // DefaultTimeout is the standard timeout for most HTTP requests (30s). DefaultTimeout = 30 * time.Second // LongTimeout is for operations that may take longer (60s). LongTimeout = 60 * time.Second )
Preset timeout durations for common use cases.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates a new HTTP client with the given options. If no timeout is specified, DefaultTimeout (30s) is used.
func NewDefault ¶
NewDefault creates a new HTTP client with the default timeout (30s).
func NewForExternal ¶ added in v0.3.0
func NewForExternal(net NetworkProxyConfig, timeout time.Duration) *http.Client
NewForExternal builds a proxy-aware *http.Client with the given timeout, reading proxy settings from the supplied config. Used by every external integration (Prowlarr, SABnzbd, NZBLNK resolver, Arrs). Internal endpoints should NOT use this — call New() or use http.DefaultClient instead.
A nil net argument disables proxying.
Types ¶
type NetworkProxyConfig ¶ added in v0.3.0
type NetworkProxyConfig interface {
GetHTTPProxy() string
GetHTTPSProxy() string
GetNoProxy() string
}
NetworkProxyConfig is the minimal interface the factory needs from the application config. Implemented by config.NetworkConfig — declared here to avoid an internal/config ↔ internal/httpclient import cycle.
type Option ¶
type Option func(*Options)
Option is a functional option for configuring HTTP clients.
func WithProxyConfig ¶ added in v0.3.0
WithProxyConfig returns an Option that installs a proxy-aware *http.Transport derived from the supplied values. Pass empty strings to disable proxying.