mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
test(zfspv): vendor for ginkgo test code
Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
d933b47c75
commit
c3c5eb1794
305 changed files with 194450 additions and 1812 deletions
27
vendor/k8s.io/apimachinery/third_party/forked/golang/netutil/addr.go
generated
vendored
Normal file
27
vendor/k8s.io/apimachinery/third_party/forked/golang/netutil/addr.go
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package netutil
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 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 { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") }
|
||||
|
||||
// FROM: http://golang.org/src/net/http/transport.go
|
||||
var portMap = map[string]string{
|
||||
"http": "80",
|
||||
"https": "443",
|
||||
}
|
||||
|
||||
// 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 {
|
||||
addr := url.Host
|
||||
if !hasPort(addr) {
|
||||
return addr + ":" + portMap[url.Scheme]
|
||||
}
|
||||
return addr
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue