浏览代码

Fix missing default shadowtls version

世界 2 年之前
父节点
当前提交
a88820af31
共有 2 个文件被更改,包括 9 次插入0 次删除
  1. 4 0
      inbound/shadowtls.go
  2. 5 0
      outbound/shadowtls.go

+ 4 - 0
inbound/shadowtls.go

@@ -32,6 +32,10 @@ func NewShadowTLS(ctx context.Context, router adapter.Router, logger log.Context
 		},
 		},
 	}
 	}
 
 
+	if options.Version == 0 {
+		options.Version = 1
+	}
+
 	var handshakeForServerName map[string]shadowtls.HandshakeConfig
 	var handshakeForServerName map[string]shadowtls.HandshakeConfig
 	if options.Version > 1 {
 	if options.Version > 1 {
 		handshakeForServerName = make(map[string]shadowtls.HandshakeConfig)
 		handshakeForServerName = make(map[string]shadowtls.HandshakeConfig)

+ 5 - 0
outbound/shadowtls.go

@@ -37,6 +37,11 @@ func NewShadowTLS(ctx context.Context, router adapter.Router, logger log.Context
 	if options.TLS == nil || !options.TLS.Enabled {
 	if options.TLS == nil || !options.TLS.Enabled {
 		return nil, C.ErrTLSRequired
 		return nil, C.ErrTLSRequired
 	}
 	}
+
+	if options.Version == 0 {
+		options.Version = 1
+	}
+
 	if options.Version == 1 {
 	if options.Version == 1 {
 		options.TLS.MinVersion = "1.2"
 		options.TLS.MinVersion = "1.2"
 		options.TLS.MaxVersion = "1.2"
 		options.TLS.MaxVersion = "1.2"