ddProxyFunc returns a transport Proxy function that routes every request through the Docker Desktop proxy except loopback targets, which connect directly. Loopback is the only local bypass: all other registry traffic is left to Docker Desktop's PAC-aware proxy so Desktop stays in control of proxy de
()
| 152 | // (docker/compose#13825 review). The sentinel proxy URL resolves to |
| 153 | // ddProxyHost, which DialContext intercepts. |
| 154 | func ddProxyFunc() func(*http.Request) (*url.URL, error) { |
| 155 | proxyURL := &url.URL{Scheme: "http", Host: ddProxyHost} |
| 156 | return func(req *http.Request) (*url.URL, error) { |
| 157 | if isLoopbackHost(req.URL.Hostname()) { |
| 158 | return nil, nil |
| 159 | } |
| 160 | return proxyURL, nil |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | // isLoopbackHost reports whether host is the loopback name "localhost" or any |
| 165 | // loopback IP (127.0.0.0/8, ::1). host must be a bare hostname with no port, |