diff --git a/handshake_server.go b/handshake_server.go index fdb1135..0079fd5 100644 --- a/handshake_server.go +++ b/handshake_server.go @@ -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, diff --git a/quic.go b/quic.go index 04e9f90..95a1995 100644 --- a/quic.go +++ b/quic.go @@ -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{