From 4b0275ab87f3cf60eb990300a5bc2cc05d5f38d5 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 28 Jul 2020 09:47:28 -0700 Subject: [PATCH] quic: refactor clientHello Refactor the `'clientHello'` event into a `clientHelloHandler` configuration option and async function. Remove the addContext API as it's not needed. PR-URL: https://github.com/nodejs/node/pull/34541 Reviewed-By: Anna Henningsen Reviewed-By: Jiawen Geng --- doc/api/quic.md | 68 +++++++------- lib/internal/quic/core.js | 108 +++++++++-------------- lib/internal/quic/util.js | 14 ++- src/quic/node_quic_session-inl.h | 11 --- src/quic/node_quic_session.cc | 97 +++++++++++--------- src/quic/node_quic_session.h | 6 +- test/parallel/test-quic-client-server.js | 32 +++---- 7 files changed, 159 insertions(+), 177 deletions(-) diff --git a/doc/api/quic.md b/doc/api/quic.md index 9a2d94080cde71..897f39245c2200 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -1274,38 +1274,6 @@ The `QuicServerSession` class implements the server side of a QUIC connection. Instances are created internally and are emitted using the `QuicSocket` `'session'` event. -#### Event: `'clientHello'` - - -Emitted at the start of the TLS handshake when the `QuicServerSession` receives -the initial TLS Client Hello. - -The event handler is given a callback function that *must* be invoked for the -handshake to continue. - -The callback is invoked with four arguments: - -* `alpn` {string} The ALPN protocol identifier requested by the client. -* `servername` {string} The SNI servername requested by the client. -* `ciphers` {string[]} The list of TLS cipher algorithms requested by the - client. -* `callback` {Function} A callback function that must be called in order for - the TLS handshake to continue. - -The `'clientHello'` event will not be emitted more than once. - -#### `quicserversession.addContext(servername\[, context\])` - - -* `servername` {string} A DNS name to associate with the given context. -* `context` {tls.SecureContext} A TLS SecureContext to associate with the `servername`. - -TBD - ### Class: `QuicSocket`