(location *url.URL)
| 171 | var wsPortMap = map[string]string{"ws": "80", "wss": "443"} |
| 172 | |
| 173 | func wsDialAddress(location *url.URL) string { |
| 174 | if _, ok := wsPortMap[location.Scheme]; ok { |
| 175 | if _, _, err := net.SplitHostPort(location.Host); err != nil { |
| 176 | return net.JoinHostPort(location.Host, wsPortMap[location.Scheme]) |
| 177 | } |
| 178 | } |
| 179 | return location.Host |
| 180 | } |
| 181 | |
| 182 | func dialContext(ctx context.Context, network, addr string) (net.Conn, error) { |
| 183 | d := &net.Dialer{KeepAlive: tcpKeepAliveInterval} |