MCPcopy
hub / github.com/gorilla/websocket / proxy_FromEnvironment

Function proxy_FromEnvironment

x_net_proxy.go:173–196  ·  view source on GitHub ↗

FromEnvironment returns the dialer specified by the proxy related variables in the environment.

()

Source from the content-addressed store, hash-verified

171// FromEnvironment returns the dialer specified by the proxy related variables in
172// the environment.
173func proxy_FromEnvironment() proxy_Dialer {
174 allProxy := proxy_allProxyEnv.Get()
175 if len(allProxy) == 0 {
176 return proxy_Direct
177 }
178
179 proxyURL, err := url.Parse(allProxy)
180 if err != nil {
181 return proxy_Direct
182 }
183 proxy, err := proxy_FromURL(proxyURL, proxy_Direct)
184 if err != nil {
185 return proxy_Direct
186 }
187
188 noProxy := proxy_noProxyEnv.Get()
189 if len(noProxy) == 0 {
190 return proxy
191 }
192
193 perHost := proxy_NewPerHost(proxy, proxy_Direct)
194 perHost.AddFromString(noProxy)
195 return perHost
196}
197
198// proxySchemes is a map from URL schemes to a function that creates a Dialer
199// from a URL with such a scheme.

Callers

nothing calls this directly

Calls 4

proxy_FromURLFunction · 0.85
proxy_NewPerHostFunction · 0.85
AddFromStringMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected