FromEnvironment returns the dialer specified by the proxy related variables in the environment.
()
| 171 | // FromEnvironment returns the dialer specified by the proxy related variables in |
| 172 | // the environment. |
| 173 | func 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. |
nothing calls this directly
no test coverage detected