Skip to content

Commit 75d7024

Browse files
jasnellMoLow
authored andcommittedJul 6, 2023
quic: add more QUIC implementation
* add TLSContext * quic: add stat collection utilities * add Packet * add NgTcp2CallbackScope/NgHttp3CallbackScope PR-URL: #47494 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent e96451e commit 75d7024

10 files changed

+1480
-8
lines changed
 

‎src/async_wrap.h

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ namespace node {
6161
V(PROMISE) \
6262
V(QUERYWRAP) \
6363
V(QUIC_LOGSTREAM) \
64+
V(QUIC_PACKET) \
6465
V(SHUTDOWNWRAP) \
6566
V(SIGNALWRAP) \
6667
V(STATWATCHER) \

‎src/node_errors.h

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ void OOMErrorHandler(const char* location, bool is_heap_oom);
6262
V(ERR_DLOPEN_FAILED, Error) \
6363
V(ERR_ENCODING_INVALID_ENCODED_DATA, TypeError) \
6464
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, Error) \
65+
V(ERR_ILLEGAL_CONSTRUCTOR, Error) \
6566
V(ERR_INVALID_ADDRESS, Error) \
6667
V(ERR_INVALID_ARG_VALUE, TypeError) \
6768
V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \
@@ -154,6 +155,7 @@ ERRORS_WITH_CODE(V)
154155
V(ERR_DLOPEN_FAILED, "DLOpen failed") \
155156
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, \
156157
"Context not associated with Node.js environment") \
158+
V(ERR_ILLEGAL_CONSTRUCTOR, "Illegal constructor") \
157159
V(ERR_INVALID_ADDRESS, "Invalid socket address") \
158160
V(ERR_INVALID_MODULE, "No such module") \
159161
V(ERR_INVALID_THIS, "Value of \"this\" is the wrong type") \

‎src/quic/bindingdata.cc

+45-1
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ void BindingData::DecreaseAllocatedSize(size_t size) {
5858

5959
void BindingData::Initialize(Environment* env, Local<Object> target) {
6060
SetMethod(env->context(), target, "setCallbacks", SetCallbacks);
61+
SetMethod(env->context(), target, "flushPacketFreelist", FlushPacketFreelist);
6162
Realm::GetCurrent(env->context())
6263
->AddBindingData<BindingData>(env->context(), target);
6364
}
6465

6566
void BindingData::RegisterExternalReferences(
6667
ExternalReferenceRegistry* registry) {
6768
registry->Register(SetCallbacks);
69+
registry->Register(FlushPacketFreelist);
6870
}
6971

7072
BindingData::BindingData(Realm* realm, Local<Object> object)
@@ -140,7 +142,7 @@ QUIC_JS_CALLBACKS(V)
140142
void BindingData::SetCallbacks(const FunctionCallbackInfo<Value>& args) {
141143
auto env = Environment::GetCurrent(args);
142144
auto isolate = env->isolate();
143-
BindingData& state = BindingData::Get(env);
145+
auto& state = BindingData::Get(env);
144146
CHECK(args[0]->IsObject());
145147
Local<Object> obj = args[0].As<Object>();
146148

@@ -159,6 +161,48 @@ void BindingData::SetCallbacks(const FunctionCallbackInfo<Value>& args) {
159161
#undef V
160162
}
161163

164+
void BindingData::FlushPacketFreelist(const FunctionCallbackInfo<Value>& args) {
165+
auto env = Environment::GetCurrent(args);
166+
auto& state = BindingData::Get(env);
167+
state.packet_freelist.clear();
168+
}
169+
170+
NgTcp2CallbackScope::NgTcp2CallbackScope(Environment* env) : env(env) {
171+
auto& binding = BindingData::Get(env);
172+
CHECK(!binding.in_ngtcp2_callback_scope);
173+
binding.in_ngtcp2_callback_scope = true;
174+
}
175+
176+
NgTcp2CallbackScope::~NgTcp2CallbackScope() {
177+
auto& binding = BindingData::Get(env);
178+
binding.in_ngtcp2_callback_scope = false;
179+
}
180+
181+
bool NgTcp2CallbackScope::in_ngtcp2_callback(Environment* env) {
182+
auto& binding = BindingData::Get(env);
183+
return binding.in_ngtcp2_callback_scope;
184+
}
185+
186+
NgHttp3CallbackScope::NgHttp3CallbackScope(Environment* env) : env(env) {
187+
auto& binding = BindingData::Get(env);
188+
CHECK(!binding.in_nghttp3_callback_scope);
189+
binding.in_nghttp3_callback_scope = true;
190+
}
191+
192+
NgHttp3CallbackScope::~NgHttp3CallbackScope() {
193+
auto& binding = BindingData::Get(env);
194+
binding.in_nghttp3_callback_scope = false;
195+
}
196+
197+
bool NgHttp3CallbackScope::in_nghttp3_callback(Environment* env) {
198+
auto& binding = BindingData::Get(env);
199+
return binding.in_nghttp3_callback_scope;
200+
}
201+
202+
void IllegalConstructor(const FunctionCallbackInfo<Value>& args) {
203+
THROW_ERR_ILLEGAL_CONSTRUCTOR(Environment::GetCurrent(args));
204+
}
205+
162206
} // namespace quic
163207
} // namespace node
164208

‎src/quic/bindingdata.h

+44-7
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
#include <node.h>
1313
#include <node_mem.h>
1414
#include <v8.h>
15+
#include <vector>
1516

1617
namespace node {
1718
namespace quic {
1819

1920
class Endpoint;
21+
class Packet;
2022

2123
enum class Side {
2224
CLIENT = NGTCP2_CRYPTO_SIDE_CLIENT,
@@ -64,23 +66,37 @@ constexpr size_t kDefaultMaxPacketLength = NGTCP2_MAX_UDP_PAYLOAD_SIZE;
6466
#define QUIC_STRINGS(V) \
6567
V(ack_delay_exponent, "ackDelayExponent") \
6668
V(active_connection_id_limit, "activeConnectionIDLimit") \
69+
V(alpn, "alpn") \
70+
V(ca, "ca") \
71+
V(certs, "certs") \
72+
V(crl, "crl") \
73+
V(ciphers, "ciphers") \
6774
V(disable_active_migration, "disableActiveMigration") \
75+
V(enable_tls_trace, "tlsTrace") \
6876
V(endpoint, "Endpoint") \
6977
V(endpoint_udp, "Endpoint::UDP") \
78+
V(groups, "groups") \
79+
V(hostname, "hostname") \
7080
V(http3_alpn, &NGHTTP3_ALPN_H3[1]) \
7181
V(initial_max_data, "initialMaxData") \
7282
V(initial_max_stream_data_bidi_local, "initialMaxStreamDataBidiLocal") \
7383
V(initial_max_stream_data_bidi_remote, "initialMaxStreamDataBidiRemote") \
7484
V(initial_max_stream_data_uni, "initialMaxStreamDataUni") \
7585
V(initial_max_streams_bidi, "initialMaxStreamsBidi") \
7686
V(initial_max_streams_uni, "initialMaxStreamsUni") \
87+
V(keylog, "keylog") \
88+
V(keys, "keys") \
7789
V(logstream, "LogStream") \
7890
V(max_ack_delay, "maxAckDelay") \
7991
V(max_datagram_frame_size, "maxDatagramFrameSize") \
8092
V(max_idle_timeout, "maxIdleTimeout") \
8193
V(packetwrap, "PacketWrap") \
94+
V(reject_unauthorized, "rejectUnauthorized") \
95+
V(request_peer_certificate, "requestPeerCertificate") \
8296
V(session, "Session") \
83-
V(stream, "Stream")
97+
V(session_id_ctx, "sessionIDContext") \
98+
V(stream, "Stream") \
99+
V(verify_hostname_identity, "verifyHostnameIdentity")
84100

85101
// =============================================================================
86102
// The BindingState object holds state for the internalBinding('quic') binding
@@ -115,12 +131,14 @@ class BindingData final
115131
// bridge out to the JS API.
116132
static void SetCallbacks(const v8::FunctionCallbackInfo<v8::Value>& args);
117133

118-
// TODO(@jasnell) This will be added when Endpoint is implemented.
119-
// // A set of listening Endpoints. We maintain this to ensure that the
120-
// Endpoint
121-
// // cannot be gc'd while it is still listening and there are active
122-
// // connections.
123-
// std::unordered_map<Endpoint*, BaseObjectPtr<Endpoint>> listening_endpoints;
134+
std::vector<BaseObjectPtr<BaseObject>> packet_freelist;
135+
136+
// Purge the packet free list to free up memory.
137+
static void FlushPacketFreelist(
138+
const v8::FunctionCallbackInfo<v8::Value>& args);
139+
140+
bool in_ngtcp2_callback_scope = false;
141+
bool in_nghttp3_callback_scope = false;
124142

125143
// The following set up various storage and accessors for common strings,
126144
// construction templates, and callbacks stored on the BindingData. These
@@ -166,6 +184,25 @@ class BindingData final
166184
#undef V
167185
};
168186

187+
void IllegalConstructor(const v8::FunctionCallbackInfo<v8::Value>& args);
188+
189+
// The ngtcp2 and nghttp3 callbacks have certain restrictions
190+
// that forbid re-entry. We provide the following scopes for
191+
// use in those to help protect against it.
192+
struct NgTcp2CallbackScope {
193+
Environment* env;
194+
explicit NgTcp2CallbackScope(Environment* env);
195+
~NgTcp2CallbackScope();
196+
static bool in_ngtcp2_callback(Environment* env);
197+
};
198+
199+
struct NgHttp3CallbackScope {
200+
Environment* env;
201+
explicit NgHttp3CallbackScope(Environment* env);
202+
~NgHttp3CallbackScope();
203+
static bool in_nghttp3_callback(Environment* env);
204+
};
205+
169206
} // namespace quic
170207
} // namespace node
171208

‎src/quic/defs.h

+48
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
#pragma once
22

3+
#include <aliased_struct.h>
34
#include <env.h>
45
#include <node_errors.h>
6+
#include <uv.h>
57
#include <v8.h>
68

79
namespace node {
810
namespace quic {
911

12+
template <typename Opt, std::string Opt::*member>
13+
bool SetOption(Environment* env,
14+
Opt* options,
15+
const v8::Local<v8::Object>& object,
16+
const v8::Local<v8::String>& name) {
17+
v8::Local<v8::Value> value;
18+
if (!object->Get(env->context(), name).ToLocal(&value)) return false;
19+
if (!value->IsUndefined()) {
20+
Utf8Value utf8(env->isolate(), value);
21+
options->*member = *utf8;
22+
}
23+
return true;
24+
}
25+
1026
template <typename Opt, bool Opt::*member>
1127
bool SetOption(Environment* env,
1228
Opt* options,
@@ -50,5 +66,37 @@ bool SetOption(Environment* env,
5066
return true;
5167
}
5268

69+
// Utilities used to update the stats for Endpoint, Session, and Stream
70+
// objects. The stats themselves are maintained in an AliasedStruct within
71+
// each of the relevant classes.
72+
73+
template <typename Stats, uint64_t Stats::*member>
74+
void IncrementStat(Stats* stats, uint64_t amt = 1) {
75+
stats->*member += amt;
76+
}
77+
78+
template <typename Stats, uint64_t Stats::*member>
79+
void RecordTimestampStat(Stats* stats) {
80+
stats->*member = uv_hrtime();
81+
}
82+
83+
template <typename Stats, uint64_t Stats::*member>
84+
void SetStat(Stats* stats, uint64_t val) {
85+
stats->*member = val;
86+
}
87+
88+
template <typename Stats, uint64_t Stats::*member>
89+
uint64_t GetStat(Stats* stats) {
90+
return stats->*member;
91+
}
92+
93+
#define STAT_INCREMENT(Type, name) IncrementStat<Type, &Type::name>(&stats_);
94+
#define STAT_INCREMENT_N(Type, name, amt) \
95+
IncrementStat<Type, &Type::name>(&stats_, amt);
96+
#define STAT_RECORD_TIMESTAMP(Type, name) \
97+
RecordTimestampStat<Type, &Type::name>(&stats_);
98+
#define STAT_SET(Type, name, val) SetStat<Type, &Type::name>(&stats_, val);
99+
#define STAT_GET(Type, name) GetStat<Type, &Type::name>(&stats_);
100+
53101
} // namespace quic
54102
} // namespace node

‎src/quic/packet.cc

+406
Large diffs are not rendered by default.

‎src/quic/packet.h

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#pragma once
2+
3+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
4+
#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
5+
6+
#include <base_object.h>
7+
#include <env.h>
8+
#include <ngtcp2/ngtcp2.h>
9+
#include <node_external_reference.h>
10+
#include <node_sockaddr.h>
11+
#include <req_wrap.h>
12+
#include <uv.h>
13+
#include <v8.h>
14+
#include <string>
15+
#include "bindingdata.h"
16+
#include "cid.h"
17+
#include "data.h"
18+
#include "tokens.h"
19+
20+
namespace node {
21+
namespace quic {
22+
23+
struct PathDescriptor {
24+
uint32_t version;
25+
const CID& dcid;
26+
const CID& scid;
27+
const SocketAddress& local_address;
28+
const SocketAddress& remote_address;
29+
};
30+
31+
// A Packet encapsulates serialized outbound QUIC data.
32+
// Packets must never be larger than the path MTU. The
33+
// default QUIC packet maximum length is 1200 bytes,
34+
// which we assume by default. The packet storage will
35+
// be stack allocated up to this size.
36+
//
37+
// Packets are maintained in a freelist held by the
38+
// BindingData instance. When using Create() to create
39+
// a Packet, we'll check to see if there is a free
40+
// packet in the freelist and use it instead of starting
41+
// fresh with a new packet. The freelist can store at
42+
// most kMaxFreeList packets
43+
//
44+
// Packets are always encrypted so their content should
45+
// be considered opaque to us. We leave it entirely up
46+
// to ngtcp2 how to encode QUIC frames into the packet.
47+
class Packet final : public ReqWrap<uv_udp_send_t> {
48+
private:
49+
struct Data;
50+
51+
public:
52+
using Queue = std::deque<BaseObjectPtr<Packet>>;
53+
54+
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
55+
Environment* env);
56+
57+
class Listener {
58+
public:
59+
virtual void PacketDone(int status) = 0;
60+
};
61+
62+
// Do not use the Packet constructors directly to create
63+
// them. These are public only to support MakeBaseObject.
64+
// Use the Create, or Create variants to create or
65+
// acquire packet instances.
66+
67+
Packet(Environment* env,
68+
Listener* listener,
69+
v8::Local<v8::Object> object,
70+
const SocketAddress& destination,
71+
size_t length,
72+
const char* diagnostic_label = "<unknown>");
73+
74+
Packet(Environment* env,
75+
Listener* listener,
76+
v8::Local<v8::Object> object,
77+
const SocketAddress& destination,
78+
std::shared_ptr<Data> data);
79+
80+
Packet(const Packet&) = delete;
81+
Packet(Packet&&) = delete;
82+
Packet& operator=(const Packet&) = delete;
83+
Packet& operator=(Packet&&) = delete;
84+
85+
const SocketAddress& destination() const;
86+
bool is_sending() const;
87+
size_t length() const;
88+
operator uv_buf_t() const;
89+
operator ngtcp2_vec() const;
90+
91+
// Modify the size of the packet after ngtcp2 has written
92+
// to it. len must be <= length(). We call this after we've
93+
// asked ngtcp2 to encode frames into the packet and ngtcp2
94+
// tells us how many of the packets bytes were used.
95+
void Truncate(size_t len);
96+
97+
static BaseObjectPtr<Packet> Create(
98+
Environment* env,
99+
Listener* listener,
100+
const SocketAddress& destination,
101+
size_t length = kDefaultMaxPacketLength,
102+
const char* diagnostic_label = "<unknown>");
103+
104+
BaseObjectPtr<Packet> Clone() const;
105+
106+
void MemoryInfo(MemoryTracker* tracker) const override;
107+
SET_MEMORY_INFO_NAME(Packet)
108+
SET_SELF_SIZE(Packet)
109+
110+
std::string ToString() const;
111+
112+
// Transmits the packet. The handle is the bound uv_udp_t
113+
// port that we're sending on, the ref is a pointer to the
114+
// HandleWrap that owns the handle.
115+
int Send(uv_udp_t* handle, BaseObjectPtr<BaseObject> ref);
116+
117+
static BaseObjectPtr<Packet> CreateRetryPacket(
118+
Environment* env,
119+
Listener* listener,
120+
const PathDescriptor& path_descriptor,
121+
const TokenSecret& token_secret);
122+
123+
static BaseObjectPtr<Packet> CreateConnectionClosePacket(
124+
Environment* env,
125+
Listener* listener,
126+
const SocketAddress& destination,
127+
ngtcp2_conn* conn,
128+
const QuicError& error);
129+
130+
static BaseObjectPtr<Packet> CreateImmediateConnectionClosePacket(
131+
Environment* env,
132+
Listener* listener,
133+
const SocketAddress& destination,
134+
const PathDescriptor& path_descriptor,
135+
const QuicError& reason);
136+
137+
static BaseObjectPtr<Packet> CreateStatelessResetPacket(
138+
Environment* env,
139+
Listener* listener,
140+
const PathDescriptor& path_descriptor,
141+
const TokenSecret& token_secret,
142+
size_t source_len);
143+
144+
static BaseObjectPtr<Packet> CreateVersionNegotiationPacket(
145+
Environment* env,
146+
Listener* listener,
147+
const PathDescriptor& path_descriptor);
148+
149+
private:
150+
static BaseObjectPtr<Packet> FromFreeList(Environment* env,
151+
std::shared_ptr<Data> data,
152+
Listener* listener,
153+
const SocketAddress& destination);
154+
155+
// Called when the packet is done being sent.
156+
void Done(int status);
157+
158+
Listener* listener_;
159+
SocketAddress destination_;
160+
std::shared_ptr<Data> data_;
161+
BaseObjectPtr<BaseObject> handle_;
162+
};
163+
164+
} // namespace quic
165+
} // namespace node
166+
167+
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
168+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

‎src/quic/tlscontext.cc

+589
Large diffs are not rendered by default.

‎src/quic/tlscontext.h

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#pragma once
2+
3+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
4+
#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
5+
6+
#include <base_object.h>
7+
#include <crypto/crypto_context.h>
8+
#include <crypto/crypto_keys.h>
9+
#include <memory_tracker.h>
10+
#include <ngtcp2/ngtcp2_crypto.h>
11+
#include "bindingdata.h"
12+
#include "data.h"
13+
#include "sessionticket.h"
14+
15+
namespace node {
16+
namespace quic {
17+
18+
class Session;
19+
20+
// Every QUIC Session has exactly one TLSContext that maintains the state
21+
// of the TLS handshake and negotiated cipher keys after the handshake has
22+
// been completed. It is separated out from the main Session class only as a
23+
// convenience to help make the code more maintainable and understandable.
24+
class TLSContext final : public MemoryRetainer {
25+
public:
26+
static constexpr auto DEFAULT_CIPHERS = "TLS_AES_128_GCM_SHA256:"
27+
"TLS_AES_256_GCM_SHA384:"
28+
"TLS_CHACHA20_POLY1305_"
29+
"SHA256:TLS_AES_128_CCM_SHA256";
30+
static constexpr auto DEFAULT_GROUPS = "X25519:P-256:P-384:P-521";
31+
32+
static inline const TLSContext& From(const SSL* ssl);
33+
static inline TLSContext& From(SSL* ssl);
34+
35+
struct Options final : public MemoryRetainer {
36+
// The protocol identifier to be used by this Session.
37+
std::string alpn = NGHTTP3_ALPN_H3;
38+
39+
// The SNI hostname to be used. This is used only by client Sessions to
40+
// identify the SNI host in the TLS client hello message.
41+
std::string hostname = "";
42+
43+
// When true, TLS keylog data will be emitted to the JavaScript session.
44+
bool keylog = false;
45+
46+
// When set, the peer certificate is verified against the list of supplied
47+
// CAs. If verification fails, the connection will be refused.
48+
bool reject_unauthorized = true;
49+
50+
// When set, enables TLS tracing for the session. This should only be used
51+
// for debugging.
52+
bool enable_tls_trace = false;
53+
54+
// Options only used by server sessions:
55+
56+
// When set, instructs the server session to request a client authentication
57+
// certificate.
58+
bool request_peer_certificate = false;
59+
60+
// Options only used by client sessions:
61+
62+
// When set, instructs the client session to verify the hostname default.
63+
// This is required by QUIC and enabled by default. We allow disabling it
64+
// only for debugging.
65+
bool verify_hostname_identity = true;
66+
67+
// The TLS session ID context (only used on the server)
68+
std::string session_id_ctx = "Node.js QUIC Server";
69+
70+
// TLS cipher suite
71+
std::string ciphers = DEFAULT_CIPHERS;
72+
73+
// TLS groups
74+
std::string groups = DEFAULT_GROUPS;
75+
76+
// The TLS private key to use for this session.
77+
std::vector<std::shared_ptr<crypto::KeyObjectData>> keys;
78+
79+
// Collection of certificates to use for this session.
80+
std::vector<Store> certs;
81+
82+
// Optional certificate authority overrides to use.
83+
std::vector<Store> ca;
84+
85+
// Optional certificate revocation lists to use.
86+
std::vector<Store> crl;
87+
88+
void MemoryInfo(MemoryTracker* tracker) const override;
89+
SET_MEMORY_INFO_NAME(CryptoContext::Options)
90+
SET_SELF_SIZE(Options)
91+
92+
static v8::Maybe<const Options> From(Environment* env,
93+
v8::Local<v8::Value> value);
94+
};
95+
96+
static const Options kDefaultOptions;
97+
98+
TLSContext(Environment* env,
99+
Side side,
100+
Session* session,
101+
const Options& options);
102+
TLSContext(const TLSContext&) = delete;
103+
TLSContext(TLSContext&&) = delete;
104+
TLSContext& operator=(const TLSContext&) = delete;
105+
TLSContext& operator=(TLSContext&&) = delete;
106+
107+
// Start the TLS handshake.
108+
void Start();
109+
110+
// TLS Keylogging is enabled per-Session by attaching a handler to the
111+
// "keylog" event. Each keylog line is emitted to JavaScript where it can be
112+
// routed to whatever destination makes sense. Typically, this will be to a
113+
// keylog file that can be consumed by tools like Wireshark to intercept and
114+
// decrypt QUIC network traffic.
115+
void Keylog(const char* line) const;
116+
117+
// Called when a chunk of peer TLS handshake data is received. For every
118+
// chunk, we move the TLS handshake further along until it is complete.
119+
int Receive(ngtcp2_crypto_level crypto_level,
120+
uint64_t offset,
121+
const ngtcp2_vec& vec);
122+
123+
v8::MaybeLocal<v8::Object> cert(Environment* env) const;
124+
v8::MaybeLocal<v8::Object> peer_cert(Environment* env) const;
125+
v8::MaybeLocal<v8::Value> cipher_name(Environment* env) const;
126+
v8::MaybeLocal<v8::Value> cipher_version(Environment* env) const;
127+
v8::MaybeLocal<v8::Object> ephemeral_key(Environment* env) const;
128+
129+
// The SNI servername negotiated for the session
130+
const std::string_view servername() const;
131+
132+
// The ALPN (protocol name) negotiated for the session
133+
const std::string_view alpn() const;
134+
135+
// Triggers key update to begin. This will fail and return false if either a
136+
// previous key update is in progress and has not been confirmed or if the
137+
// initial handshake has not yet been confirmed.
138+
bool InitiateKeyUpdate();
139+
140+
int VerifyPeerIdentity();
141+
142+
Side side() const;
143+
const Options& options() const;
144+
145+
int OnNewSession(SSL_SESSION* session);
146+
147+
void MaybeSetEarlySession(const SessionTicket& sessionTicket);
148+
bool early_data_was_accepted() const;
149+
150+
void MemoryInfo(MemoryTracker* tracker) const override;
151+
SET_MEMORY_INFO_NAME(CryptoContext)
152+
SET_SELF_SIZE(TLSContext)
153+
154+
private:
155+
static ngtcp2_conn* getConnection(ngtcp2_crypto_conn_ref* ref);
156+
ngtcp2_crypto_conn_ref conn_ref_;
157+
158+
Side side_;
159+
Environment* env_;
160+
Session* session_;
161+
const Options options_;
162+
BaseObjectPtr<crypto::SecureContext> secure_context_;
163+
crypto::SSLPointer ssl_;
164+
crypto::BIOPointer bio_trace_;
165+
166+
bool in_key_update_ = false;
167+
bool early_data_ = false;
168+
169+
friend class Session;
170+
};
171+
172+
} // namespace quic
173+
} // namespace node
174+
175+
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
176+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

‎test/sequential/test-async-wrap-getasyncid.js

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const { getSystemErrorName } = require('util');
6767
delete providers.RANDOMPRIMEREQUEST;
6868
delete providers.CHECKPRIMEREQUEST;
6969
delete providers.QUIC_LOGSTREAM;
70+
delete providers.QUIC_PACKET;
7071

7172
const objKeys = Object.keys(providers);
7273
if (objKeys.length > 0)

0 commit comments

Comments
 (0)
Please sign in to comment.