From a88820af313905d0e967ac13e02ee75ba38fe122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 11 Mar 2023 10:12:46 +0800 Subject: [PATCH] Fix missing default shadowtls version --- inbound/shadowtls.go | 4 ++++ outbound/shadowtls.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/inbound/shadowtls.go b/inbound/shadowtls.go index 21028e05..cd7a4db8 100644 --- a/inbound/shadowtls.go +++ b/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 if options.Version > 1 { handshakeForServerName = make(map[string]shadowtls.HandshakeConfig) diff --git a/outbound/shadowtls.go b/outbound/shadowtls.go index 616a4baf..7e06f166 100644 --- a/outbound/shadowtls.go +++ b/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 { return nil, C.ErrTLSRequired } + + if options.Version == 0 { + options.Version = 1 + } + if options.Version == 1 { options.TLS.MinVersion = "1.2" options.TLS.MaxVersion = "1.2"