Fix websocket alpn

This commit is contained in:
arm64v8a 2022-11-11 20:01:49 +08:00 committed by 世界
parent 3d76777760
commit 2c9d25e853
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -34,6 +34,9 @@ func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, opt
HandshakeTimeout: time.Second * 8, HandshakeTimeout: time.Second * 8,
} }
if tlsConfig != nil { if tlsConfig != nil {
if len(tlsConfig.NextProtos()) == 0 {
tlsConfig.SetNextProtos([]string{"http/1.1"})
}
wsDialer.NetDialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) { wsDialer.NetDialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
conn, err := dialer.DialContext(ctx, network, M.ParseSocksaddr(addr)) conn, err := dialer.DialContext(ctx, network, M.ParseSocksaddr(addr))
if err != nil { if err != nil {