isLoopbackHost reports whether host is the loopback name "localhost" or any loopback IP (127.0.0.0/8, ::1). host must be a bare hostname with no port, e.g. the result of url.URL.Hostname.
(host string)
| 165 | // loopback IP (127.0.0.0/8, ::1). host must be a bare hostname with no port, |
| 166 | // e.g. the result of url.URL.Hostname. |
| 167 | func isLoopbackHost(host string) bool { |
| 168 | if strings.EqualFold(host, "localhost") { |
| 169 | return true |
| 170 | } |
| 171 | if ip := net.ParseIP(host); ip != nil { |
| 172 | return ip.IsLoopback() |
| 173 | } |
| 174 | return false |
| 175 | } |
| 176 | |
| 177 | // ProxyTransportFor discovers the Docker Desktop endpoint via apiClient and |
| 178 | // returns the matching transport, or nil when DD is not active or discovery |