split SNI and ECH extensions in the ClientHello (#5107)

* create a new type for crypto stream used for Initial data

This currently the exact same implementation as the other
streams, thus no functional change is expected.

* handshake: implement a function to find the SNI and the ECH extension

* move the SNI parsing logic to the quic package

* implement splitting logic

* generalize cutting logic

* introduce QUIC_GO_DISABLE_CLIENTHELLO_SCRAMBLING

* improve testing
This commit is contained in:
Marten Seemann
2025-05-05 19:04:10 +08:00
committed by GitHub
parent 11ccfff388
commit 57e46f8a4c
11 changed files with 851 additions and 56 deletions

View File

@@ -22,7 +22,7 @@ func TestCryptoStreamManager(t *testing.T) {
}
func testCryptoStreamManager(t *testing.T, encLevel protocol.EncryptionLevel) {
initialStream := newCryptoStream()
initialStream := newInitialCryptoStream(true)
handshakeStream := newCryptoStream()
oneRTTStream := newCryptoStream()
csm := newCryptoStreamManager(initialStream, handshakeStream, oneRTTStream)
@@ -58,7 +58,7 @@ func TestCryptoStreamManagerDropEncryptionLevel(t *testing.T) {
}
func testCryptoStreamManagerDropEncryptionLevel(t *testing.T, encLevel protocol.EncryptionLevel) {
initialStream := newCryptoStream()
initialStream := newInitialCryptoStream(true)
handshakeStream := newCryptoStream()
oneRTTStream := newCryptoStream()
csm := newCryptoStreamManager(initialStream, handshakeStream, oneRTTStream)
@@ -71,7 +71,7 @@ func testCryptoStreamManagerDropEncryptionLevel(t *testing.T, encLevel protocol.
}
func TestCryptoStreamManagerPostHandshake(t *testing.T) {
initialStream := newCryptoStream()
initialStream := newInitialCryptoStream(true)
handshakeStream := newCryptoStream()
oneRTTStream := newCryptoStream()
csm := newCryptoStreamManager(initialStream, handshakeStream, oneRTTStream)