From c095026177bda0a0cef5a347b7ef2c79acfd3d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 18 Feb 2023 14:35:41 +0800 Subject: [PATCH] Add shadowtls tls config --- common/tls/config.go | 7 ++++--- transport/shadowtls/config_119.go | 16 ++++++++++++++++ transport/shadowtls/config_120.go | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 transport/shadowtls/config_119.go create mode 100644 transport/shadowtls/config_120.go diff --git a/common/tls/config.go b/common/tls/config.go index 0885f6c5..8a4ee660 100644 --- a/common/tls/config.go +++ b/common/tls/config.go @@ -10,8 +10,9 @@ import ( ) type ( - STDConfig = tls.Config - STDConn = tls.Conn + STDConfig = tls.Config + STDConn = tls.Conn + ConnectionState = tls.ConnectionState ) type Config interface { @@ -33,7 +34,7 @@ type ServerConfig interface { type Conn interface { net.Conn HandshakeContext(ctx context.Context) error - ConnectionState() tls.ConnectionState + ConnectionState() ConnectionState } func ParseTLSVersion(version string) (uint16, error) { diff --git a/transport/shadowtls/config_119.go b/transport/shadowtls/config_119.go new file mode 100644 index 00000000..b879c8b6 --- /dev/null +++ b/transport/shadowtls/config_119.go @@ -0,0 +1,16 @@ +//go:build !go1.20 + +package shadowtls + +import sTLS "github.com/sagernet/sing-box/transport/shadowtls/tls_go119" + +type ( + sTLSConfig = sTLS.Config + sTLSConnectionState = sTLS.ConnectionState + sTLSConn = sTLS.Conn +) + +var ( + sTLSCipherSuites = sTLS.CipherSuites + sTLSClient = sTLS.Client +) diff --git a/transport/shadowtls/config_120.go b/transport/shadowtls/config_120.go new file mode 100644 index 00000000..69ee6f90 --- /dev/null +++ b/transport/shadowtls/config_120.go @@ -0,0 +1,16 @@ +//go:build go1.20 + +package shadowtls + +import sTLS "github.com/sagernet/sing-box/transport/shadowtls/tls" + +type ( + sTLSConfig = sTLS.Config + sTLSConnectionState = sTLS.ConnectionState + sTLSConn = sTLS.Conn +) + +var ( + sTLSCipherSuites = sTLS.CipherSuites + sTLSClient = sTLS.Client +)