Documentation
¶
Overview ¶
Package netproxy selects the outbound transport for provider HTTP traffic.
Providers whose useSystemProxy toggle is on use the proxied transport, which resolves the proxy from the configuration LiveAgent hands over; all other providers use the direct transport (Proxy == nil, environment ignored). Loopback hosts are never proxied. Proxy URLs and credentials are never logged or included in errors.
Index ¶
Constants ¶
const EnvVar = "LIVEAGENT_KBRAIN_PROXY"
EnvVar carries the LiveAgent app proxy into the backend process. Values: a proxy URL (http, https, socks5, socks5h), "direct" for app proxy disabled, or "invalid" for an enabled but unusable app proxy. When unset, the standard HTTPS_PROXY/HTTP_PROXY/NO_PROXY variables are used instead.
Variables ¶
var ErrInvalidProxy = errors.New("app proxy is enabled but its configuration is invalid")
ErrInvalidProxy fails proxied requests while the app proxy is enabled but misconfigured, instead of silently falling back to a direct connection.
Functions ¶
func ContextTransport ¶
func ContextTransport() http.RoundTripper
ContextTransport routes each request by the toggle stored with WithProvider; requests without a mark go direct.
func Set ¶
Set replaces the proxy used by proxied providers. It applies to subsequent requests without rebuilding clients. An unparseable value is stored as invalid (proxied requests fail) and reported to the caller.
func Transport ¶
func Transport(useProxy bool) http.RoundTripper
Transport returns the cached transport for the provider toggle.
Types ¶
This section is empty.