// FROM: http://golang.org/src/net/http/client.go // Given a string of the form "host", "host:port", or "[ipv6::address]:port", // return true if the string includes a port. func hasPort(s string) bool { … } var portMap … // FROM: http://golang.org/src/net/http/transport.go // canonicalAddr returns url.Host but always with a ":port" suffix func CanonicalAddr(url *url.URL) string { … }