Merge from remote branch[ssh]

This commit is contained in:
yaling888 2022-01-18 10:05:06 +08:00
parent daae846db3
commit 56c38890f9

View File

@ -1,8 +1,10 @@
package vless
import (
"context"
"net"
C "github.com/Dreamacro/clash/constant"
xtls "github.com/xtls/go"
)
@ -20,6 +22,10 @@ func StreamXTLSConn(conn net.Conn, cfg *XTLSConfig) (net.Conn, error) {
}
xtlsConn := xtls.Client(conn, xtlsConfig)
err := xtlsConn.Handshake()
// fix tls handshake not timeout
ctx, cancel := context.WithTimeout(context.Background(), C.DefaultTLSTimeout)
defer cancel()
err := xtlsConn.HandshakeContext(ctx)
return xtlsConn, err
}