[Fix] 修正因xray服务端alpn参数为http/1.1而导致无法连接的问题

This commit is contained in:
gVisor bot 2021-12-05 02:18:58 +08:00
parent af1faabd04
commit 885ea9f7bf

View file

@ -83,7 +83,7 @@ func (v *Vless) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error) {
wsOpts.TLSConfig = &tls.Config{ wsOpts.TLSConfig = &tls.Config{
ServerName: host, ServerName: host,
InsecureSkipVerify: v.option.SkipCertVerify, InsecureSkipVerify: v.option.SkipCertVerify,
NextProtos: []string{"http/1.1"}, NextProtos: []string{"h2", "http/1.1"},
} }
if v.option.ServerName != "" { if v.option.ServerName != "" {
wsOpts.TLSConfig.ServerName = v.option.ServerName wsOpts.TLSConfig.ServerName = v.option.ServerName
@ -292,7 +292,7 @@ func (uc *vlessPacketConn) ReadFrom(b []byte) (int, net.Addr, error) {
} }
func NewVless(option VlessOption) (*Vless, error) { func NewVless(option VlessOption) (*Vless, error) {
if !option.TLS && option.Network =="grpc"{ if !option.TLS && option.Network == "grpc" {
return nil, fmt.Errorf("TLS must be true with vless-grpc") return nil, fmt.Errorf("TLS must be true with vless-grpc")
} }