gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/net/websocket/dial.go (about) 1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package websocket 6 7 import ( 8 "net" 9 10 tls "gitee.com/ks-custle/core-gm/gmtls" 11 ) 12 13 func dialWithDialer(dialer *net.Dialer, config *Config) (conn net.Conn, err error) { 14 switch config.Location.Scheme { 15 case "ws": 16 conn, err = dialer.Dial("tcp", parseAuthority(config.Location)) 17 18 case "wss": 19 conn, err = tls.DialWithDialer(dialer, "tcp", parseAuthority(config.Location), config.TlsConfig) 20 21 default: 22 err = ErrBadScheme 23 } 24 return 25 }