• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H06-Apr-2020-

autoload/H06-Apr-2020-

pacfile_examples/H06-Apr-2020-

.gitignoreH A D06-Apr-20207

LICENSEH A D06-Apr-20201.1 KiB

README.mdH A D06-Apr-20202 KiB

example_test.goH A D06-Apr-2020746

go.modH A D06-Apr-2020201

go.sumH A D06-Apr-20201 KiB

ieproxy.goH A D06-Apr-20201.7 KiB

ieproxy_unix.goH A D06-Apr-2020155

ieproxy_windows.goH A D06-Apr-20205.7 KiB

kernel32_data_windows.goH A D06-Apr-2020337

pac_unix.goH A D06-Apr-2020115

pac_windows.goH A D06-Apr-20202 KiB

proxy_middleman.goH A D06-Apr-2020218

proxy_middleman_unix.goH A D06-Apr-2020237

proxy_middleman_windows.goH A D06-Apr-20201.3 KiB

utils.goH A D06-Apr-2020350

utils_test.goH A D06-Apr-2020548

windows_test.goH A D06-Apr-20204.7 KiB

winhttp_data_windows.goH A D06-Apr-20201.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