Blame vendor/github.com/mattn/go-ieproxy/README.md

Packit 63bb0d
# ieproxy
Packit 63bb0d
Packit 63bb0d
Go package to detect the proxy settings on Windows platform.
Packit 63bb0d
Packit 63bb0d
The settings are initially attempted to be read from the [`WinHttpGetIEProxyConfigForCurrentUser` DLL call](https://docs.microsoft.com/en-us/windows/desktop/api/winhttp/nf-winhttp-winhttpgetieproxyconfigforcurrentuser), but falls back to the registry (`CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings`) in the event the DLL call fails.
Packit 63bb0d
Packit 63bb0d
For more information, take a look at the [documentation](https://godoc.org/github.com/mattn/go-ieproxy)
Packit 63bb0d
Packit 63bb0d
## Methods
Packit 63bb0d
Packit 63bb0d
You can either obtain a `net/http` compatible proxy function using `ieproxy.GetProxyFunc()`, set environment variables using `ieproxy.OverrideEnvWithStaticProxy()` (though no automatic configuration is available this way), or obtain the proxy settings via `ieproxy.GetConf()`.
Packit 63bb0d
Packit 63bb0d
| Method                                 | Supported configuration options:              |
Packit 63bb0d
|----------------------------------------|-----------------------------------------------|
Packit 63bb0d
| `ieproxy.GetProxyFunc()`               | Static, Specified script, and fully automatic |
Packit 63bb0d
| `ieproxy.OverrideEnvWithStaticProxy()` | Static                                        |
Packit 63bb0d
| `ieproxy.GetConf()`                    | Depends on how you use it                     |
Packit 63bb0d
Packit 63bb0d
## Examples
Packit 63bb0d
Packit 63bb0d
### Using GetProxyFunc():
Packit 63bb0d
Packit 63bb0d
```go
Packit 63bb0d
func init() {
Packit 63bb0d
	http.DefaultTransport.(*http.Transport).Proxy = ieproxy.GetProxyFunc()
Packit 63bb0d
}
Packit 63bb0d
```
Packit 63bb0d
Packit 63bb0d
GetProxyFunc acts as a middleman between `net/http` and `mattn/go-ieproxy` in order to select the correct proxy configuration based off the details supplied in the config.
Packit 63bb0d
Packit 63bb0d
### Using OverrideEnvWithStaticProxy():
Packit 63bb0d
Packit 63bb0d
```go
Packit 63bb0d
func init() {
Packit 63bb0d
	ieproxy.OverrideEnvWithStaticProxy()
Packit 63bb0d
	http.DefaultTransport.(*http.Transport).Proxy = http.ProxyFromEnvironment
Packit 63bb0d
}
Packit 63bb0d
```
Packit 63bb0d
Packit 63bb0d
OverrideEnvWithStaticProxy overrides the relevant environment variables (`HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY`) with the **static, manually configured** proxy details typically found in the registry.
Packit 63bb0d
Packit 63bb0d
### Using GetConf():
Packit 63bb0d
Packit 63bb0d
```go
Packit 63bb0d
func main() {
Packit 63bb0d
	conf := ieproxy.GetConf()
Packit 63bb0d
	//Handle proxies how you want to.
Packit 63bb0d
}
Packit 63bb0d
```