Documentation
¶
Index ¶
- type Manager
- func (m *Manager) GetUpstreamConn(ctx context.Context, req *http.Request) (net.Conn, error)
- func (m *Manager) GetUpstreamProxyURL(req *http.Request) (*url.URL, error)
- func (m *Manager) RealUpstreamProxy() func(*http.Request) (*url.URL, error)
- func (m *Manager) SetUpstreamProxy(fn func(*http.Request) (*url.URL, error))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles upstream proxy connections and configuration. It manages the logic for connecting to upstream servers and determining which proxy to use for each request.
func NewManager ¶
NewManager creates a new Manager with the given configuration. Upstream is the upstream proxy address. If empty, environment variables will be used. SslInsecure controls whether to skip SSL certificate verification.
func (*Manager) GetUpstreamConn ¶
GetUpstreamConn establishes a connection to the upstream server. It determines the appropriate proxy (if any) and creates a connection to the target server, either directly or through the proxy.
func (*Manager) GetUpstreamProxyURL ¶
GetUpstreamProxyURL returns the upstream proxy URL for a given request. It checks in order: 1. Custom upstream proxy function (if set via SetUpstreamProxy) 2. Upstream field (if configured) 3. Environment variables (HTTP_PROXY, HTTPS_PROXY, etc.)
func (*Manager) RealUpstreamProxy ¶
RealUpstreamProxy returns a function that resolves upstream proxy for HTTP client transport. This is used by the HTTP client to determine the proxy for each request. The returned function extracts the original request from the context and uses it to determine the appropriate proxy.
func (*Manager) SetUpstreamProxy ¶
SetUpstreamProxy sets a custom upstream proxy function. This function will be called to determine the proxy URL for each request. If not set, the manager will use the config.Upstream or environment variables.