netproxy

package
v0.107.6-beta.8 Latest Latest
Warning

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

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

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

View Source
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

View Source
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

func Set(value string) error

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.

func WithProvider

func WithProvider(ctx context.Context, useProxy bool) context.Context

WithProvider marks ctx with the provider's proxy toggle for clients that serve several providers through one ContextTransport.

Types

This section is empty.

Jump to

Keyboard shortcuts

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