crypto/tls: add QUICConfig.ClientHelloInfoConn

Fixes #77363.

Change-Id: I28ec5cdd16e96bae13f495a904006845dfbf3a2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/745720
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
This commit is contained in:
yuhan6665
2026-09-08 21:33:47 -04:00
parent 31529cb535
commit c2a3952d66
2 changed files with 11 additions and 1 deletions
+5 -1
View File
@@ -1007,6 +1007,10 @@ func clientHelloInfo(ctx context.Context, c *Conn, clientHello *clientHelloMsg)
supportedVersions = supportedVersionsFromMax(clientHello.vers)
}
conn := c.conn
if c.quic != nil {
conn = c.quic.clientHelloInfoConn
}
return &ClientHelloInfo{
CipherSuites: clientHello.cipherSuites,
ServerName: clientHello.serverName,
@@ -1016,7 +1020,7 @@ func clientHelloInfo(ctx context.Context, c *Conn, clientHello *clientHelloMsg)
SupportedProtos: clientHello.alpnProtocols,
SupportedVersions: supportedVersions,
Extensions: clientHello.extensions,
Conn: c.conn,
Conn: conn,
HelloRetryRequest: c.didHRR,
config: c.config,
ctx: ctx,
+6
View File
@@ -8,6 +8,7 @@ import (
"context"
"errors"
"fmt"
"net"
)
// QUICEncryptionLevel represents a QUIC encryption level used to transmit
@@ -56,6 +57,9 @@ type QUICConfig struct {
// stored in the client session cache.
// The application should use [QUICConn.StoreSession] to store sessions.
EnableSessionEvents bool
// ClientHelloInfoConn is the net.Conn to use for the ClientHelloInfo.Conn field.
ClientHelloInfoConn net.Conn
}
// A QUICEventKind is a type of operation on a QUIC connection.
@@ -176,6 +180,7 @@ type quicState struct {
transportParams []byte // to send to the peer
enableSessionEvents bool
clientHelloInfoConn net.Conn
}
// QUICClient returns a new TLS client side connection using QUICTransport as the
@@ -200,6 +205,7 @@ func newQUICConn(conn *Conn, config *QUICConfig) *QUICConn {
signalc: make(chan struct{}),
blockedc: make(chan struct{}),
enableSessionEvents: config.EnableSessionEvents,
clientHelloInfoConn: config.ClientHelloInfoConn,
}
conn.quic.events = conn.quic.eventArr[:0]
return &QUICConn{