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

Function isLoopbackHost

internal/desktop/proxy.go:167–175  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
167func 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

Callers 1

ddProxyFuncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected