Documentation
¶
Overview ¶
Package sysproxy chooses the proxy an outbound HTTP request goes through the way .NET, and so PowerShell, chooses it on the same host (ADR-0464).
Why ¶
Go's default transport reads only the HTTPS_PROXY family of variables. A Windows server is usually configured the other way: a PAC script or a proxy in Internet Options, set by group policy, and no variable at all. There every PowerShell a Worker starts finds the proxy and every Go Worker goes direct — into a firewall that drops the packets, so the request fails on a timeout rather than with a message. One host then has two network paths, and which one a task takes depends on the language its Worker is written in.
The choice, made once at startup ¶
- ATLAS_SYSTEM_PROXY=off keeps Go's own behaviour: the variables, nothing else.
- A proxy variable (HTTPS_PROXY, HTTP_PROXY, either case) wins, as it does in .NET, and Go's transport reads it as it always has.
- Otherwise, on Windows, the account's proxy settings as WinHTTP reports them: a PAC URL, automatic detection (WPAD), a manual proxy and its bypass list. That is what .NET's HttpWindowsProxy reads, and the rules below are its rules.
- Anywhere else, or with no settings, nothing changes.
The rules for one request ¶
Loopback and the host's own addresses never go through a proxy, whatever a PAC script says: a supervised Worker reaches its own server over 127.0.0.1, or over the address the server listens on. Auto-configuration, when set, is asked first and its answer is final, DIRECT included; when it cannot answer, the manual proxy applies with its bypass list; with neither, the request goes direct. Auto-detection that found nothing is not tried again for two minutes, because WPAD discovery can take seconds. An answer is believed for five minutes per scheme, host and port; a fallback after a failure for thirty seconds, so a passing PAC outage does not pin a host to the wrong route. Only the first proxy of a list is used: Go's transport takes one per request, where .NET fails over along the list.
Index ¶
Constants ¶
const EnvSwitch = "ATLAS_SYSTEM_PROXY"
EnvSwitch turns the Windows settings off: off, false, 0 or no keeps Go's default.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mode ¶
type Mode string
Mode says where this process takes its outbound proxy from.
const ( // ModeEnvironment: a proxy variable is set, and Go's transport reads it. ModeEnvironment Mode = "environment" // ModeWindows: the Windows proxy settings, read the way .NET reads them. ModeWindows Mode = "windows" // ModeOff: ATLAS_SYSTEM_PROXY switched the Windows settings off. ModeOff Mode = "off" // ModeNone: no system settings to follow — not Windows, or none configured. ModeNone Mode = "none" )