MCPcopy
hub / github.com/gorilla/websocket / hostPortNoPort

Function hostPortNoPort

client.go:122–138  ·  view source on GitHub ↗
(u *url.URL)

Source from the content-addressed store, hash-verified

120var errMalformedURL = errors.New("malformed ws or wss URL")
121
122func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) {
123 hostPort = u.Host
124 hostNoPort = u.Host
125 if i := strings.LastIndex(u.Host, ":"); i > strings.LastIndex(u.Host, "]") {
126 hostNoPort = hostNoPort[:i]
127 } else {
128 switch u.Scheme {
129 case "wss":
130 hostPort += ":443"
131 case "https":
132 hostPort += ":443"
133 default:
134 hostPort += ":80"
135 }
136 }
137 return hostPort, hostNoPort
138}
139
140// DefaultDialer is a dialer with all fields set to the default values.
141var DefaultDialer = &Dialer{

Callers 3

DialMethod · 0.85
TestHostPortNoPortFunction · 0.85
DialContextMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestHostPortNoPortFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…