Fix missing default shadowtls version

This commit is contained in:
世界 2023-03-11 10:12:46 +08:00
parent 3688f2e114
commit a88820af31
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 9 additions and 0 deletions

View file

@ -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)

View file

@ -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"