Translate "tls" network to "tcp"
This commit is contained in:
parent
09b2259a8c
commit
c9480ba016
12
dial.go
12
dial.go
@ -42,6 +42,8 @@ func DialQUIC(ctx context.Context, network, address string, tlsConf *tls.Config)
|
|||||||
|
|
||||||
// DialTLS opens a connection to a server over TLS.
|
// DialTLS opens a connection to a server over TLS.
|
||||||
func DialTLS(ctx context.Context, network, address string, tlsConf *tls.Config) (Conn, error) {
|
func DialTLS(ctx context.Context, network, address string, tlsConf *tls.Config) (Conn, error) {
|
||||||
|
network, err := tlsNetworkToTCPNetwork(network)
|
||||||
|
if err != nil { return nil, err }
|
||||||
conn, err := tls.Dial(network, address, tlsConf)
|
conn, err := tls.Dial(network, address, tlsConf)
|
||||||
if err != nil { return nil, err }
|
if err != nil { return nil, err }
|
||||||
return AdaptA(conn, ClientSide), nil
|
return AdaptA(conn, ClientSide), nil
|
||||||
@ -73,7 +75,6 @@ func tlsConfig(conf *tls.Config) *tls.Config {
|
|||||||
return conf
|
return conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func quicNetworkToUDPNetwork(network string) (string, error) {
|
func quicNetworkToUDPNetwork(network string) (string, error) {
|
||||||
switch network {
|
switch network {
|
||||||
case "quic4": return "udp4", nil
|
case "quic4": return "udp4", nil
|
||||||