github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/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 "github.com/hxx258456/ccgo/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 }