From 3963be90c1e64efd7f6561795220a9329b1f5500 Mon Sep 17 00:00:00 2001 From: wy Date: Thu, 6 Aug 2026 17:20:11 +0800 Subject: [PATCH] preserve ECH acceptance in uTLS state --- internal/handshake/tls_conn_utls.go | 6 +++++- internal/handshake/tls_conn_utls_test.go | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 internal/handshake/tls_conn_utls_test.go diff --git a/internal/handshake/tls_conn_utls.go b/internal/handshake/tls_conn_utls.go index ff8b9228517..03e98aeb9f5 100644 --- a/internal/handshake/tls_conn_utls.go +++ b/internal/handshake/tls_conn_utls.go @@ -219,7 +219,10 @@ func (c *utlsQUICConn) StoreSession(*tls.SessionState) error { } func (c *utlsQUICConn) ConnectionState() tls.ConnectionState { - s := c.conn.ConnectionState() + return utlsConnectionStateToStd(c.conn.ConnectionState()) +} + +func utlsConnectionStateToStd(s utls.ConnectionState) tls.ConnectionState { return tls.ConnectionState{ Version: s.Version, HandshakeComplete: s.HandshakeComplete, @@ -232,6 +235,7 @@ func (c *utlsQUICConn) ConnectionState() tls.ConnectionState { VerifiedChains: s.VerifiedChains, SignedCertificateTimestamps: s.SignedCertificateTimestamps, OCSPResponse: s.OCSPResponse, + ECHAccepted: s.ECHAccepted, } } diff --git a/internal/handshake/tls_conn_utls_test.go b/internal/handshake/tls_conn_utls_test.go new file mode 100644 index 00000000000..978c79cd3a9 --- /dev/null +++ b/internal/handshake/tls_conn_utls_test.go @@ -0,0 +1,13 @@ +package handshake + +import ( + "testing" + + utls "github.com/refraction-networking/utls" + "github.com/stretchr/testify/require" +) + +func TestUTLSConnectionStateToStdPreservesECHAccepted(t *testing.T) { + state := utlsConnectionStateToStd(utls.ConnectionState{ECHAccepted: true}) + require.True(t, state.ECHAccepted) +}