MCPcopy
hub / github.com/docker/compose / ddProxyFunc

Function ddProxyFunc

internal/desktop/proxy.go:154–162  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

152// (docker/compose#13825 review). The sentinel proxy URL resolves to
153// ddProxyHost, which DialContext intercepts.
154func 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,

Callers 2

ProxyTransportFunction · 0.85

Calls 1

isLoopbackHostFunction · 0.85

Tested by 1