Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
.github/ | H | 06-Apr-2020 | - | |||
autoload/ | H | 06-Apr-2020 | - | |||
pacfile_examples/ | H | 06-Apr-2020 | - | |||
.gitignore | H A D | 06-Apr-2020 | 7 | |||
LICENSE | H A D | 06-Apr-2020 | 1.1 KiB | |||
README.md | H A D | 06-Apr-2020 | 2 KiB | |||
example_test.go | H A D | 06-Apr-2020 | 746 | |||
go.mod | H A D | 06-Apr-2020 | 201 | |||
go.sum | H A D | 06-Apr-2020 | 1 KiB | |||
ieproxy.go | H A D | 06-Apr-2020 | 1.7 KiB | |||
ieproxy_unix.go | H A D | 06-Apr-2020 | 155 | |||
ieproxy_windows.go | H A D | 06-Apr-2020 | 5.7 KiB | |||
kernel32_data_windows.go | H A D | 06-Apr-2020 | 337 | |||
pac_unix.go | H A D | 06-Apr-2020 | 115 | |||
pac_windows.go | H A D | 06-Apr-2020 | 2 KiB | |||
proxy_middleman.go | H A D | 06-Apr-2020 | 218 | |||
proxy_middleman_unix.go | H A D | 06-Apr-2020 | 237 | |||
proxy_middleman_windows.go | H A D | 06-Apr-2020 | 1.3 KiB | |||
utils.go | H A D | 06-Apr-2020 | 350 | |||
utils_test.go | H A D | 06-Apr-2020 | 548 | |||
windows_test.go | H A D | 06-Apr-2020 | 4.7 KiB | |||
winhttp_data_windows.go | H A D | 06-Apr-2020 | 1.7 KiB |
README.md
1# ieproxy 2 3Go package to detect the proxy settings on Windows platform. 4 5The 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. 6 7For more information, take a look at the [documentation](https://godoc.org/github.com/mattn/go-ieproxy) 8 9## Methods 10 11You 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()`. 12 13| Method | Supported configuration options: | 14|----------------------------------------|-----------------------------------------------| 15| `ieproxy.GetProxyFunc()` | Static, Specified script, and fully automatic | 16| `ieproxy.OverrideEnvWithStaticProxy()` | Static | 17| `ieproxy.GetConf()` | Depends on how you use it | 18 19## Examples 20 21### Using GetProxyFunc(): 22 23```go 24func init() { 25 http.DefaultTransport.(*http.Transport).Proxy = ieproxy.GetProxyFunc() 26} 27``` 28 29GetProxyFunc 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. 30 31### Using OverrideEnvWithStaticProxy(): 32 33```go 34func init() { 35 ieproxy.OverrideEnvWithStaticProxy() 36 http.DefaultTransport.(*http.Transport).Proxy = http.ProxyFromEnvironment 37} 38``` 39 40OverrideEnvWithStaticProxy overrides the relevant environment variables (`HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY`) with the **static, manually configured** proxy details typically found in the registry. 41 42### Using GetConf(): 43 44```go 45func main() { 46 conf := ieproxy.GetConf() 47 //Handle proxies how you want to. 48} 49``` 50