MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / SetProxy

Function SetProxy

internal/util/proxy.go:17–30  ·  view source on GitHub ↗

SetProxy configures the provided HTTP client with proxy settings from the configuration. It supports SOCKS5, HTTP, and HTTPS proxies. The function modifies the client's transport to route requests through the configured proxy server.

(cfg *config.SDKConfig, httpClient *http.Client)

Source from the content-addressed store, hash-verified

15// It supports SOCKS5, HTTP, and HTTPS proxies. The function modifies the client's transport
16// to route requests through the configured proxy server.
17func SetProxy(cfg *config.SDKConfig, httpClient *http.Client) *http.Client {
18 if cfg == nil || httpClient == nil {
19 return httpClient
20 }
21
22 transport, _, errBuild := proxyutil.BuildHTTPTransport(cfg.ProxyURL)
23 if errBuild != nil {
24 log.Errorf("%v", errBuild)
25 }
26 if transport != nil {
27 httpClient.Transport = transport
28 }
29 return httpClient
30}

Callers 9

NewXAIAuthWithProxyURLFunction · 0.92
NewAntigravityAuthFunction · 0.92
NewCodexAuthWithProxyURLFunction · 0.92
newHTTPClientFunction · 0.92
sync.goFile · 0.92
GetLatestVersionMethod · 0.92
newPluginStoreClientMethod · 0.92
loginWithDeviceFlowMethod · 0.92

Calls 1

BuildHTTPTransportFunction · 0.92

Tested by

no test coverage detected