@kungfu-tech/libnode-win32-x64 22.22.3-kf.0 → 22.22.3-kf.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/include/acorn_version.h +6 -0
- package/dist/node/include/aliased_buffer-inl.h +244 -0
- package/dist/node/include/aliased_buffer.h +206 -0
- package/dist/node/include/aliased_struct-inl.h +54 -0
- package/dist/node/include/aliased_struct.h +63 -0
- package/dist/node/include/amaro_version.h +6 -0
- package/dist/node/include/async_context_frame.h +33 -0
- package/dist/node/include/async_wrap-inl.h +96 -0
- package/dist/node/include/async_wrap.h +243 -0
- package/dist/node/include/base_object-inl.h +335 -0
- package/dist/node/include/base_object.h +342 -0
- package/dist/node/include/base_object_types.h +74 -0
- package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
- package/dist/node/include/blob_serializer_deserializer.h +132 -0
- package/dist/node/include/callback_queue-inl.h +97 -0
- package/dist/node/include/callback_queue.h +79 -0
- package/dist/node/include/cares_wrap.h +447 -0
- package/dist/node/include/cjs_module_lexer_version.h +6 -0
- package/dist/node/include/cleanup_queue-inl.h +36 -0
- package/dist/node/include/cleanup_queue.h +79 -0
- package/dist/node/include/compile_cache.h +104 -0
- package/dist/node/include/connect_wrap.h +26 -0
- package/dist/node/include/connection_wrap.h +30 -0
- package/dist/node/include/cppgc/allocation.h +310 -0
- package/dist/node/include/cppgc/common.h +28 -0
- package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
- package/dist/node/include/cppgc/custom-space.h +97 -0
- package/dist/node/include/cppgc/default-platform.h +67 -0
- package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
- package/dist/node/include/cppgc/explicit-management.h +100 -0
- package/dist/node/include/cppgc/garbage-collected.h +106 -0
- package/dist/node/include/cppgc/heap-consistency.h +309 -0
- package/dist/node/include/cppgc/heap-handle.h +48 -0
- package/dist/node/include/cppgc/heap-state.h +82 -0
- package/dist/node/include/cppgc/heap-statistics.h +120 -0
- package/dist/node/include/cppgc/heap.h +202 -0
- package/dist/node/include/cppgc/internal/api-constants.h +87 -0
- package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
- package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
- package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
- package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
- package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
- package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
- package/dist/node/include/cppgc/internal/gc-info.h +148 -0
- package/dist/node/include/cppgc/internal/logging.h +50 -0
- package/dist/node/include/cppgc/internal/member-storage.h +256 -0
- package/dist/node/include/cppgc/internal/name-trait.h +137 -0
- package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
- package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
- package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
- package/dist/node/include/cppgc/liveness-broker.h +78 -0
- package/dist/node/include/cppgc/macros.h +35 -0
- package/dist/node/include/cppgc/member.h +629 -0
- package/dist/node/include/cppgc/name-provider.h +65 -0
- package/dist/node/include/cppgc/object-size-trait.h +58 -0
- package/dist/node/include/cppgc/persistent.h +377 -0
- package/dist/node/include/cppgc/platform.h +163 -0
- package/dist/node/include/cppgc/prefinalizer.h +75 -0
- package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
- package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
- package/dist/node/include/cppgc/source-location.h +16 -0
- package/dist/node/include/cppgc/testing.h +106 -0
- package/dist/node/include/cppgc/trace-trait.h +128 -0
- package/dist/node/include/cppgc/type-traits.h +271 -0
- package/dist/node/include/cppgc/visitor.h +504 -0
- package/dist/node/include/crypto/crypto_aes.h +88 -0
- package/dist/node/include/crypto/crypto_bio.h +193 -0
- package/dist/node/include/crypto/crypto_cipher.h +293 -0
- package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
- package/dist/node/include/crypto/crypto_clienthello.h +131 -0
- package/dist/node/include/crypto/crypto_common.h +64 -0
- package/dist/node/include/crypto/crypto_context.h +171 -0
- package/dist/node/include/crypto/crypto_dh.h +126 -0
- package/dist/node/include/crypto/crypto_dsa.h +52 -0
- package/dist/node/include/crypto/crypto_ec.h +164 -0
- package/dist/node/include/crypto/crypto_hash.h +91 -0
- package/dist/node/include/crypto/crypto_hkdf.h +61 -0
- package/dist/node/include/crypto/crypto_hmac.h +92 -0
- package/dist/node/include/crypto/crypto_keygen.h +299 -0
- package/dist/node/include/crypto/crypto_keys.h +392 -0
- package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
- package/dist/node/include/crypto/crypto_random.h +124 -0
- package/dist/node/include/crypto/crypto_rsa.h +136 -0
- package/dist/node/include/crypto/crypto_scrypt.h +85 -0
- package/dist/node/include/crypto/crypto_sig.h +165 -0
- package/dist/node/include/crypto/crypto_spkac.h +21 -0
- package/dist/node/include/crypto/crypto_timing.h +20 -0
- package/dist/node/include/crypto/crypto_tls.h +305 -0
- package/dist/node/include/crypto/crypto_util.h +725 -0
- package/dist/node/include/crypto/crypto_x509.h +140 -0
- package/dist/node/include/dataqueue/queue.h +306 -0
- package/dist/node/include/debug_utils-inl.h +278 -0
- package/dist/node/include/debug_utils.h +196 -0
- package/dist/node/include/diagnosticfilename-inl.h +33 -0
- package/dist/node/include/embedded_data.h +17 -0
- package/dist/node/include/encoding_binding.h +61 -0
- package/dist/node/include/env-inl.h +984 -0
- package/dist/node/include/env.h +1287 -0
- package/dist/node/include/env_properties.h +540 -0
- package/dist/node/include/handle_wrap.h +123 -0
- package/dist/node/include/histogram-inl.h +107 -0
- package/dist/node/include/histogram.h +279 -0
- package/dist/node/include/inspector/io_agent.h +30 -0
- package/dist/node/include/inspector/main_thread_interface.h +116 -0
- package/dist/node/include/inspector/network_agent.h +94 -0
- package/dist/node/include/inspector/network_inspector.h +45 -0
- package/dist/node/include/inspector/network_requests_buffer.h +195 -0
- package/dist/node/include/inspector/network_resource_manager.h +29 -0
- package/dist/node/include/inspector/node_json.h +24 -0
- package/dist/node/include/inspector/node_string.h +101 -0
- package/dist/node/include/inspector/protocol_helper.h +27 -0
- package/dist/node/include/inspector/runtime_agent.h +41 -0
- package/dist/node/include/inspector/target_agent.h +75 -0
- package/dist/node/include/inspector/tracing_agent.h +43 -0
- package/dist/node/include/inspector/worker_agent.h +40 -0
- package/dist/node/include/inspector/worker_inspector.h +124 -0
- package/dist/node/include/inspector_agent.h +165 -0
- package/dist/node/include/inspector_io.h +78 -0
- package/dist/node/include/inspector_profiler.h +149 -0
- package/dist/node/include/inspector_socket.h +60 -0
- package/dist/node/include/inspector_socket_server.h +110 -0
- package/dist/node/include/js_native_api.h +607 -0
- package/dist/node/include/js_native_api_types.h +226 -0
- package/dist/node/include/js_native_api_v8.h +485 -0
- package/dist/node/include/js_native_api_v8_internals.h +45 -0
- package/dist/node/include/js_stream.h +52 -0
- package/dist/node/include/json_utils.h +172 -0
- package/dist/node/include/large_pages/node_large_page.h +34 -0
- package/dist/node/include/libplatform/libplatform-export.h +29 -0
- package/dist/node/include/libplatform/libplatform.h +112 -0
- package/dist/node/include/libplatform/v8-tracing.h +333 -0
- package/dist/node/include/memory_tracker-inl.h +359 -0
- package/dist/node/include/memory_tracker.h +289 -0
- package/dist/node/include/module_wrap.h +216 -0
- package/dist/node/include/node.h +1593 -0
- package/dist/node/include/node_api.h +265 -0
- package/dist/node/include/node_api_internals.h +48 -0
- package/dist/node/include/node_api_types.h +56 -0
- package/dist/node/include/node_binding.h +161 -0
- package/dist/node/include/node_blob.h +159 -0
- package/dist/node/include/node_bob-inl.h +36 -0
- package/dist/node/include/node_bob.h +107 -0
- package/dist/node/include/node_buffer.h +92 -0
- package/dist/node/include/node_builtins.h +220 -0
- package/dist/node/include/node_config_file.h +46 -0
- package/dist/node/include/node_constants.h +82 -0
- package/dist/node/include/node_context_data.h +168 -0
- package/dist/node/include/node_contextify.h +204 -0
- package/dist/node/include/node_crypto.h +56 -0
- package/dist/node/include/node_debug.h +30 -0
- package/dist/node/include/node_dir.h +52 -0
- package/dist/node/include/node_dotenv.h +45 -0
- package/dist/node/include/node_errors.h +380 -0
- package/dist/node/include/node_exit_code.h +54 -0
- package/dist/node/include/node_external_reference.h +165 -0
- package/dist/node/include/node_file-inl.h +406 -0
- package/dist/node/include/node_file.h +537 -0
- package/dist/node/include/node_http2.h +1177 -0
- package/dist/node/include/node_http2_state.h +159 -0
- package/dist/node/include/node_http_common-inl.h +202 -0
- package/dist/node/include/node_http_common.h +535 -0
- package/dist/node/include/node_i18n.h +132 -0
- package/dist/node/include/node_internals.h +483 -0
- package/dist/node/include/node_main_instance.h +67 -0
- package/dist/node/include/node_mem-inl.h +113 -0
- package/dist/node/include/node_mem.h +45 -0
- package/dist/node/include/node_messaging.h +389 -0
- package/dist/node/include/node_metadata.h +164 -0
- package/dist/node/include/node_modules.h +91 -0
- package/dist/node/include/node_mutex.h +323 -0
- package/dist/node/include/node_object_wrap.h +132 -0
- package/dist/node/include/node_options-inl.h +490 -0
- package/dist/node/include/node_options.h +615 -0
- package/dist/node/include/node_perf.h +166 -0
- package/dist/node/include/node_perf_common.h +102 -0
- package/dist/node/include/node_platform.h +238 -0
- package/dist/node/include/node_process-inl.h +26 -0
- package/dist/node/include/node_process.h +112 -0
- package/dist/node/include/node_realm-inl.h +151 -0
- package/dist/node/include/node_realm.h +183 -0
- package/dist/node/include/node_report.h +43 -0
- package/dist/node/include/node_revert.h +82 -0
- package/dist/node/include/node_root_certs.h +3520 -0
- package/dist/node/include/node_sea.h +74 -0
- package/dist/node/include/node_shadow_realm.h +46 -0
- package/dist/node/include/node_snapshot_builder.h +57 -0
- package/dist/node/include/node_snapshotable.h +174 -0
- package/dist/node/include/node_sockaddr-inl.h +257 -0
- package/dist/node/include/node_sockaddr.h +394 -0
- package/dist/node/include/node_sqlite.h +270 -0
- package/dist/node/include/node_stat_watcher.h +73 -0
- package/dist/node/include/node_task_runner.h +92 -0
- package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
- package/dist/node/include/node_threadsafe_cow.h +105 -0
- package/dist/node/include/node_union_bytes.h +81 -0
- package/dist/node/include/node_url.h +96 -0
- package/dist/node/include/node_v8.h +77 -0
- package/dist/node/include/node_v8_platform-inl.h +185 -0
- package/dist/node/include/node_version.h +110 -0
- package/dist/node/include/node_wasi.h +184 -0
- package/dist/node/include/node_wasm_web_api.h +55 -0
- package/dist/node/include/node_watchdog.h +154 -0
- package/dist/node/include/node_webstorage.h +60 -0
- package/dist/node/include/node_worker.h +158 -0
- package/dist/node/include/path.h +33 -0
- package/dist/node/include/permission/addon_permission.h +31 -0
- package/dist/node/include/permission/child_process_permission.h +31 -0
- package/dist/node/include/permission/fs_permission.h +167 -0
- package/dist/node/include/permission/inspector_permission.h +31 -0
- package/dist/node/include/permission/permission.h +138 -0
- package/dist/node/include/permission/permission_base.h +65 -0
- package/dist/node/include/permission/wasi_permission.h +31 -0
- package/dist/node/include/permission/worker_permission.h +31 -0
- package/dist/node/include/pipe_wrap.h +80 -0
- package/dist/node/include/quic/application.h +159 -0
- package/dist/node/include/quic/bindingdata.h +272 -0
- package/dist/node/include/quic/cid.h +127 -0
- package/dist/node/include/quic/data.h +148 -0
- package/dist/node/include/quic/defs.h +245 -0
- package/dist/node/include/quic/endpoint.h +458 -0
- package/dist/node/include/quic/http3.h +15 -0
- package/dist/node/include/quic/logstream.h +81 -0
- package/dist/node/include/quic/packet.h +152 -0
- package/dist/node/include/quic/preferredaddress.h +72 -0
- package/dist/node/include/quic/session.h +443 -0
- package/dist/node/include/quic/sessionticket.h +108 -0
- package/dist/node/include/quic/streams.h +232 -0
- package/dist/node/include/quic/tlscontext.h +227 -0
- package/dist/node/include/quic/tokens.h +256 -0
- package/dist/node/include/quic/transportparams.h +165 -0
- package/dist/node/include/req_wrap-inl.h +171 -0
- package/dist/node/include/req_wrap.h +77 -0
- package/dist/node/include/spawn_sync.h +243 -0
- package/dist/node/include/stream_base-inl.h +173 -0
- package/dist/node/include/stream_base.h +478 -0
- package/dist/node/include/stream_pipe.h +76 -0
- package/dist/node/include/stream_wrap.h +132 -0
- package/dist/node/include/string_bytes.h +113 -0
- package/dist/node/include/string_decoder-inl.h +31 -0
- package/dist/node/include/string_decoder.h +49 -0
- package/dist/node/include/tcp_wrap.h +105 -0
- package/dist/node/include/threadpoolwork-inl.h +70 -0
- package/dist/node/include/timer_wrap-inl.h +32 -0
- package/dist/node/include/timer_wrap.h +85 -0
- package/dist/node/include/timers.h +70 -0
- package/dist/node/include/tracing/agent.h +195 -0
- package/dist/node/include/tracing/node_trace_buffer.h +83 -0
- package/dist/node/include/tracing/node_trace_writer.h +75 -0
- package/dist/node/include/tracing/trace_event.h +722 -0
- package/dist/node/include/tracing/trace_event_common.h +1109 -0
- package/dist/node/include/tracing/traced_value.h +129 -0
- package/dist/node/include/tty_wrap.h +65 -0
- package/dist/node/include/udp_wrap.h +230 -0
- package/dist/node/include/undici_version.h +6 -0
- package/dist/node/include/util-inl.h +700 -0
- package/dist/node/include/util.h +1021 -0
- package/dist/node/include/uv/aix.h +32 -0
- package/dist/node/include/uv/bsd.h +34 -0
- package/dist/node/include/uv/darwin.h +61 -0
- package/dist/node/include/uv/errno.h +483 -0
- package/dist/node/include/uv/linux.h +34 -0
- package/dist/node/include/uv/os390.h +33 -0
- package/dist/node/include/uv/posix.h +31 -0
- package/dist/node/include/uv/sunos.h +44 -0
- package/dist/node/include/uv/threadpool.h +37 -0
- package/dist/node/include/uv/tree.h +521 -0
- package/dist/node/include/uv/unix.h +512 -0
- package/dist/node/include/uv/version.h +43 -0
- package/dist/node/include/uv/win.h +698 -0
- package/dist/node/include/uv.h +1990 -0
- package/dist/node/include/v8-array-buffer.h +525 -0
- package/dist/node/include/v8-callbacks.h +462 -0
- package/dist/node/include/v8-container.h +183 -0
- package/dist/node/include/v8-context.h +485 -0
- package/dist/node/include/v8-cppgc.h +245 -0
- package/dist/node/include/v8-data.h +80 -0
- package/dist/node/include/v8-date.h +48 -0
- package/dist/node/include/v8-debug.h +168 -0
- package/dist/node/include/v8-embedder-heap.h +82 -0
- package/dist/node/include/v8-embedder-state-scope.h +52 -0
- package/dist/node/include/v8-exception.h +223 -0
- package/dist/node/include/v8-extension.h +62 -0
- package/dist/node/include/v8-external.h +37 -0
- package/dist/node/include/v8-fast-api-calls.h +984 -0
- package/dist/node/include/v8-forward.h +82 -0
- package/dist/node/include/v8-function-callback.h +607 -0
- package/dist/node/include/v8-function.h +140 -0
- package/dist/node/include/v8-handle-base.h +137 -0
- package/dist/node/include/v8-initialization.h +289 -0
- package/dist/node/include/v8-inspector-protocol.h +13 -0
- package/dist/node/include/v8-inspector.h +419 -0
- package/dist/node/include/v8-internal.h +1397 -0
- package/dist/node/include/v8-isolate.h +1767 -0
- package/dist/node/include/v8-json.h +47 -0
- package/dist/node/include/v8-local-handle.h +758 -0
- package/dist/node/include/v8-locker.h +138 -0
- package/dist/node/include/v8-maybe.h +160 -0
- package/dist/node/include/v8-memory-span.h +198 -0
- package/dist/node/include/v8-message.h +233 -0
- package/dist/node/include/v8-metrics.h +264 -0
- package/dist/node/include/v8-microtask-queue.h +157 -0
- package/dist/node/include/v8-microtask.h +28 -0
- package/dist/node/include/v8-object.h +824 -0
- package/dist/node/include/v8-persistent-handle.h +582 -0
- package/dist/node/include/v8-platform.h +1358 -0
- package/dist/node/include/v8-primitive-object.h +118 -0
- package/dist/node/include/v8-primitive.h +877 -0
- package/dist/node/include/v8-profiler.h +1302 -0
- package/dist/node/include/v8-promise.h +174 -0
- package/dist/node/include/v8-proxy.h +50 -0
- package/dist/node/include/v8-regexp.h +106 -0
- package/dist/node/include/v8-script.h +904 -0
- package/dist/node/include/v8-snapshot.h +266 -0
- package/dist/node/include/v8-source-location.h +92 -0
- package/dist/node/include/v8-statistics.h +238 -0
- package/dist/node/include/v8-template.h +1297 -0
- package/dist/node/include/v8-traced-handle.h +432 -0
- package/dist/node/include/v8-typed-array.h +390 -0
- package/dist/node/include/v8-unwinder-state.h +31 -0
- package/dist/node/include/v8-unwinder.h +132 -0
- package/dist/node/include/v8-util.h +665 -0
- package/dist/node/include/v8-value-serializer-version.h +24 -0
- package/dist/node/include/v8-value-serializer.h +316 -0
- package/dist/node/include/v8-value.h +655 -0
- package/dist/node/include/v8-version-string.h +38 -0
- package/dist/node/include/v8-version.h +20 -0
- package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
- package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
- package/dist/node/include/v8-wasm.h +201 -0
- package/dist/node/include/v8-weak-callback-info.h +80 -0
- package/dist/node/include/v8.h +88 -0
- package/dist/node/include/v8config.h +981 -0
- package/dist/node/include/zlib_version.h +6 -0
- package/dist/node/libnode.dll +0 -0
- package/dist/node/libnode.lib +0 -0
- package/dist/node/libnodebuildinfo.json +10 -0
- package/dist/node/link_node.lib +0 -0
- package/dist/node/link_node.node +0 -0
- package/ensure-libnode-aliases.js +41 -0
- package/index.js +2 -0
- package/libnode.release.json +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,152 @@
|
|
|
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 "defs.h"
|
|
19
|
+
#include "tokens.h"
|
|
20
|
+
|
|
21
|
+
namespace node::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
|
+
std::string ToString() const;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// A Packet encapsulates serialized outbound QUIC data.
|
|
33
|
+
// Packets must never be larger than the path MTU. The
|
|
34
|
+
// default QUIC packet maximum length is 1200 bytes,
|
|
35
|
+
// which we assume by default. The packet storage will
|
|
36
|
+
// be stack allocated up to this size.
|
|
37
|
+
//
|
|
38
|
+
// Packets are maintained in a freelist held by the
|
|
39
|
+
// BindingData instance. When using Create() to create
|
|
40
|
+
// a Packet, we'll check to see if there is a free
|
|
41
|
+
// packet in the freelist and use it instead of starting
|
|
42
|
+
// fresh with a new packet. The freelist can store at
|
|
43
|
+
// most kMaxFreeList packets
|
|
44
|
+
//
|
|
45
|
+
// Packets are always encrypted so their content should
|
|
46
|
+
// be considered opaque to us. We leave it entirely up
|
|
47
|
+
// to ngtcp2 how to encode QUIC frames into the packet.
|
|
48
|
+
class Packet final : public ReqWrap<uv_udp_send_t> {
|
|
49
|
+
private:
|
|
50
|
+
struct Data;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
|
|
54
|
+
Environment* env);
|
|
55
|
+
|
|
56
|
+
class Listener {
|
|
57
|
+
public:
|
|
58
|
+
virtual void PacketDone(int status) = 0;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Do not use the Packet constructors directly to create
|
|
62
|
+
// them. These are public only to support MakeBaseObject.
|
|
63
|
+
// Use the Create, or Create variants to create or
|
|
64
|
+
// acquire packet instances.
|
|
65
|
+
|
|
66
|
+
Packet(Environment* env,
|
|
67
|
+
Listener* listener,
|
|
68
|
+
v8::Local<v8::Object> object,
|
|
69
|
+
const SocketAddress& destination,
|
|
70
|
+
size_t length,
|
|
71
|
+
const char* diagnostic_label = "<unknown>");
|
|
72
|
+
|
|
73
|
+
Packet(Environment* env,
|
|
74
|
+
Listener* listener,
|
|
75
|
+
v8::Local<v8::Object> object,
|
|
76
|
+
const SocketAddress& destination,
|
|
77
|
+
std::shared_ptr<Data> data);
|
|
78
|
+
|
|
79
|
+
DISALLOW_COPY_AND_MOVE(Packet)
|
|
80
|
+
|
|
81
|
+
const SocketAddress& destination() const;
|
|
82
|
+
size_t length() const;
|
|
83
|
+
operator uv_buf_t() const;
|
|
84
|
+
operator ngtcp2_vec() const;
|
|
85
|
+
|
|
86
|
+
// Modify the size of the packet after ngtcp2 has written
|
|
87
|
+
// to it. len must be <= length(). We call this after we've
|
|
88
|
+
// asked ngtcp2 to encode frames into the packet and ngtcp2
|
|
89
|
+
// tells us how many of the packets bytes were used.
|
|
90
|
+
void Truncate(size_t len);
|
|
91
|
+
|
|
92
|
+
static Packet* Create(Environment* env,
|
|
93
|
+
Listener* listener,
|
|
94
|
+
const SocketAddress& destination,
|
|
95
|
+
size_t length = kDefaultMaxPacketLength,
|
|
96
|
+
const char* diagnostic_label = "<unknown>");
|
|
97
|
+
|
|
98
|
+
Packet* Clone() const;
|
|
99
|
+
|
|
100
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
101
|
+
SET_MEMORY_INFO_NAME(Packet)
|
|
102
|
+
SET_SELF_SIZE(Packet)
|
|
103
|
+
|
|
104
|
+
std::string ToString() const;
|
|
105
|
+
|
|
106
|
+
static Packet* CreateRetryPacket(Environment* env,
|
|
107
|
+
Listener* listener,
|
|
108
|
+
const PathDescriptor& path_descriptor,
|
|
109
|
+
const TokenSecret& token_secret);
|
|
110
|
+
|
|
111
|
+
static Packet* CreateConnectionClosePacket(Environment* env,
|
|
112
|
+
Listener* listener,
|
|
113
|
+
const SocketAddress& destination,
|
|
114
|
+
ngtcp2_conn* conn,
|
|
115
|
+
const QuicError& error);
|
|
116
|
+
|
|
117
|
+
static Packet* CreateImmediateConnectionClosePacket(
|
|
118
|
+
Environment* env,
|
|
119
|
+
Listener* listener,
|
|
120
|
+
const PathDescriptor& path_descriptor,
|
|
121
|
+
const QuicError& reason);
|
|
122
|
+
|
|
123
|
+
static Packet* CreateStatelessResetPacket(
|
|
124
|
+
Environment* env,
|
|
125
|
+
Listener* listener,
|
|
126
|
+
const PathDescriptor& path_descriptor,
|
|
127
|
+
const TokenSecret& token_secret,
|
|
128
|
+
size_t source_len);
|
|
129
|
+
|
|
130
|
+
static Packet* CreateVersionNegotiationPacket(
|
|
131
|
+
Environment* env,
|
|
132
|
+
Listener* listener,
|
|
133
|
+
const PathDescriptor& path_descriptor);
|
|
134
|
+
|
|
135
|
+
// Called when the packet is done being sent.
|
|
136
|
+
void Done(int status);
|
|
137
|
+
|
|
138
|
+
private:
|
|
139
|
+
static Packet* FromFreeList(Environment* env,
|
|
140
|
+
std::shared_ptr<Data> data,
|
|
141
|
+
Listener* listener,
|
|
142
|
+
const SocketAddress& destination);
|
|
143
|
+
|
|
144
|
+
Listener* listener_;
|
|
145
|
+
SocketAddress destination_;
|
|
146
|
+
std::shared_ptr<Data> data_;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
} // namespace node::quic
|
|
150
|
+
|
|
151
|
+
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
|
|
152
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
4
|
+
#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
|
|
5
|
+
|
|
6
|
+
#include <env.h>
|
|
7
|
+
#include <ngtcp2/ngtcp2.h>
|
|
8
|
+
#include <node_internals.h>
|
|
9
|
+
#include <v8.h>
|
|
10
|
+
#include <string>
|
|
11
|
+
#include "defs.h"
|
|
12
|
+
|
|
13
|
+
namespace node::quic {
|
|
14
|
+
|
|
15
|
+
// PreferredAddress is a helper class used only when a client Session receives
|
|
16
|
+
// an advertised preferred address from a server. The helper provides
|
|
17
|
+
// information about the server advertised preferred address and allows
|
|
18
|
+
// the preferred address to be selected.
|
|
19
|
+
class PreferredAddress final {
|
|
20
|
+
public:
|
|
21
|
+
enum class Policy : uint32_t {
|
|
22
|
+
// Ignore the server-advertised preferred address.
|
|
23
|
+
IGNORE_PREFERRED,
|
|
24
|
+
// Use the server-advertised preferred address.
|
|
25
|
+
USE_PREFERRED,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
static v8::Maybe<Policy> tryGetPolicy(Environment* env,
|
|
29
|
+
v8::Local<v8::Value> value);
|
|
30
|
+
|
|
31
|
+
// The QUIC_* constants are expected to be exported out to be used on
|
|
32
|
+
// the JavaScript side of the API.
|
|
33
|
+
static constexpr auto PREFERRED_ADDRESS_USE =
|
|
34
|
+
static_cast<uint32_t>(Policy::USE_PREFERRED);
|
|
35
|
+
static constexpr auto PREFERRED_ADDRESS_IGNORE =
|
|
36
|
+
static_cast<uint32_t>(Policy::IGNORE_PREFERRED);
|
|
37
|
+
static constexpr auto DEFAULT_PREFERRED_ADDRESS_POLICY =
|
|
38
|
+
static_cast<uint32_t>(Policy::USE_PREFERRED);
|
|
39
|
+
|
|
40
|
+
static void Initialize(Environment* env, v8::Local<v8::Object> target);
|
|
41
|
+
|
|
42
|
+
struct AddressInfo final {
|
|
43
|
+
char host[NI_MAXHOST];
|
|
44
|
+
int family;
|
|
45
|
+
uint16_t port;
|
|
46
|
+
std::string_view address;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
explicit PreferredAddress(ngtcp2_path* dest,
|
|
50
|
+
const ngtcp2_preferred_addr* paddr);
|
|
51
|
+
DISALLOW_COPY_AND_MOVE(PreferredAddress)
|
|
52
|
+
|
|
53
|
+
void Use(const AddressInfo& address);
|
|
54
|
+
|
|
55
|
+
std::optional<const AddressInfo> ipv4() const;
|
|
56
|
+
std::optional<const AddressInfo> ipv6() const;
|
|
57
|
+
|
|
58
|
+
// Set the preferred address in the transport params.
|
|
59
|
+
// The address family (ipv4 or ipv6) will be automatically
|
|
60
|
+
// detected from the given addr. Any other address family
|
|
61
|
+
// will be ignored.
|
|
62
|
+
static void Set(ngtcp2_transport_params* params, const sockaddr* addr);
|
|
63
|
+
|
|
64
|
+
private:
|
|
65
|
+
ngtcp2_path* dest_;
|
|
66
|
+
const ngtcp2_preferred_addr* paddr_;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
} // namespace node::quic
|
|
70
|
+
|
|
71
|
+
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
|
|
72
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
4
|
+
#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
|
|
5
|
+
|
|
6
|
+
#include <async_wrap.h>
|
|
7
|
+
#include <base_object.h>
|
|
8
|
+
#include <env.h>
|
|
9
|
+
#include <memory_tracker.h>
|
|
10
|
+
#include <ngtcp2/ngtcp2.h>
|
|
11
|
+
#include <node_http_common.h>
|
|
12
|
+
#include <node_sockaddr.h>
|
|
13
|
+
#include <timer_wrap.h>
|
|
14
|
+
#include <util.h>
|
|
15
|
+
#include <optional>
|
|
16
|
+
#include "bindingdata.h"
|
|
17
|
+
#include "cid.h"
|
|
18
|
+
#include "data.h"
|
|
19
|
+
#include "defs.h"
|
|
20
|
+
#include "logstream.h"
|
|
21
|
+
#include "packet.h"
|
|
22
|
+
#include "preferredaddress.h"
|
|
23
|
+
#include "sessionticket.h"
|
|
24
|
+
#include "streams.h"
|
|
25
|
+
#include "tlscontext.h"
|
|
26
|
+
#include "transportparams.h"
|
|
27
|
+
|
|
28
|
+
namespace node::quic {
|
|
29
|
+
|
|
30
|
+
class Endpoint;
|
|
31
|
+
|
|
32
|
+
// A Session represents one half of a persistent connection between two QUIC
|
|
33
|
+
// peers. Every Session is established first by performing a TLS handshake in
|
|
34
|
+
// which the client sends an initial packet to the server containing a TLS
|
|
35
|
+
// client hello. Once the TLS handshake has been completed, the Session can be
|
|
36
|
+
// used to open one or more Streams for the actual data flow back and forth.
|
|
37
|
+
//
|
|
38
|
+
// While client and server Sessions are created in slightly different ways,
|
|
39
|
+
// their lifecycles are generally identical:
|
|
40
|
+
//
|
|
41
|
+
// A Session is either acting as a Client or as a Server.
|
|
42
|
+
//
|
|
43
|
+
// Client Sessions are always created using Endpoint::Connect()
|
|
44
|
+
//
|
|
45
|
+
// Server Sessions are always created by an Endpoint receiving a valid initial
|
|
46
|
+
// request received from a remote client.
|
|
47
|
+
//
|
|
48
|
+
// As soon as Sessions of either type are created, they will immediately start
|
|
49
|
+
// working through the TLS handshake to establish the crypographic keys used to
|
|
50
|
+
// secure the communication. Once those keys are established, the Session can be
|
|
51
|
+
// used to open Streams. Based on how the Session is configured, any number of
|
|
52
|
+
// Streams can exist concurrently on a single Session.
|
|
53
|
+
class Session final : public AsyncWrap, private SessionTicket::AppData::Source {
|
|
54
|
+
public:
|
|
55
|
+
// For simplicity, we use the same Application::Options struct for all
|
|
56
|
+
// Application types. This may change in the future. Not all of the options
|
|
57
|
+
// are going to be relevant for all Application types.
|
|
58
|
+
struct Application_Options final : public MemoryRetainer {
|
|
59
|
+
// The maximum number of header pairs permitted for a Stream.
|
|
60
|
+
// Only relevant if the selected application supports headers.
|
|
61
|
+
uint64_t max_header_pairs = DEFAULT_MAX_HEADER_LIST_PAIRS;
|
|
62
|
+
|
|
63
|
+
// The maximum total number of header bytes (including header
|
|
64
|
+
// name and value) permitted for a Stream.
|
|
65
|
+
// Only relevant if the selected application supports headers.
|
|
66
|
+
uint64_t max_header_length = DEFAULT_MAX_HEADER_LENGTH;
|
|
67
|
+
|
|
68
|
+
// HTTP/3 specific options.
|
|
69
|
+
uint64_t max_field_section_size = 0;
|
|
70
|
+
uint64_t qpack_max_dtable_capacity = 0;
|
|
71
|
+
uint64_t qpack_encoder_max_dtable_capacity = 0;
|
|
72
|
+
uint64_t qpack_blocked_streams = 0;
|
|
73
|
+
|
|
74
|
+
bool enable_connect_protocol = true;
|
|
75
|
+
bool enable_datagrams = true;
|
|
76
|
+
|
|
77
|
+
operator const nghttp3_settings() const;
|
|
78
|
+
|
|
79
|
+
SET_NO_MEMORY_INFO()
|
|
80
|
+
SET_MEMORY_INFO_NAME(Application::Options)
|
|
81
|
+
SET_SELF_SIZE(Options)
|
|
82
|
+
|
|
83
|
+
static v8::Maybe<Application_Options> From(Environment* env,
|
|
84
|
+
v8::Local<v8::Value> value);
|
|
85
|
+
|
|
86
|
+
std::string ToString() const;
|
|
87
|
+
|
|
88
|
+
static const Application_Options kDefault;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// An Application implements the ALPN-protocol specific semantics on behalf
|
|
92
|
+
// of a QUIC Session.
|
|
93
|
+
class Application;
|
|
94
|
+
|
|
95
|
+
// The options used to configure a session. Most of these deal directly with
|
|
96
|
+
// the transport parameters that are exchanged with the remote peer during
|
|
97
|
+
// handshake.
|
|
98
|
+
struct Options final : public MemoryRetainer {
|
|
99
|
+
// The QUIC protocol version requested for the session.
|
|
100
|
+
uint32_t version = NGTCP2_PROTO_VER_MAX;
|
|
101
|
+
|
|
102
|
+
// Te minimum QUIC protocol version supported by this session.
|
|
103
|
+
uint32_t min_version = NGTCP2_PROTO_VER_MIN;
|
|
104
|
+
|
|
105
|
+
// By default a client session will use the preferred address advertised by
|
|
106
|
+
// the the server. This option is only relevant for client sessions.
|
|
107
|
+
PreferredAddress::Policy preferred_address_strategy =
|
|
108
|
+
PreferredAddress::Policy::USE_PREFERRED;
|
|
109
|
+
|
|
110
|
+
TransportParams::Options transport_params =
|
|
111
|
+
TransportParams::Options::kDefault;
|
|
112
|
+
TLSContext::Options tls_options = TLSContext::Options::kDefault;
|
|
113
|
+
Application_Options application_options = Application_Options::kDefault;
|
|
114
|
+
|
|
115
|
+
// A reference to the CID::Factory used to generate CID instances
|
|
116
|
+
// for this session.
|
|
117
|
+
const CID::Factory* cid_factory = &CID::Factory::random();
|
|
118
|
+
// If the CID::Factory is a base object, we keep a reference to it
|
|
119
|
+
// so that it cannot be garbage collected.
|
|
120
|
+
BaseObjectPtr<BaseObject> cid_factory_ref = BaseObjectPtr<BaseObject>();
|
|
121
|
+
|
|
122
|
+
// When true, QLog output will be enabled for the session.
|
|
123
|
+
bool qlog = false;
|
|
124
|
+
|
|
125
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
126
|
+
SET_MEMORY_INFO_NAME(Session::Options)
|
|
127
|
+
SET_SELF_SIZE(Options)
|
|
128
|
+
|
|
129
|
+
static v8::Maybe<Options> From(Environment* env,
|
|
130
|
+
v8::Local<v8::Value> value);
|
|
131
|
+
|
|
132
|
+
std::string ToString() const;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// The additional configuration settings used to create a specific session.
|
|
136
|
+
// while the Options above can be used to configure multiple sessions, a
|
|
137
|
+
// single Config is used to create a single session, which is why they are
|
|
138
|
+
// kept separate.
|
|
139
|
+
struct Config final : MemoryRetainer {
|
|
140
|
+
// Is the Session acting as a client or a server?
|
|
141
|
+
Side side;
|
|
142
|
+
|
|
143
|
+
// The options to use for this session.
|
|
144
|
+
Options options;
|
|
145
|
+
|
|
146
|
+
// The actual QUIC version identified for this session.
|
|
147
|
+
uint32_t version;
|
|
148
|
+
|
|
149
|
+
SocketAddress local_address;
|
|
150
|
+
SocketAddress remote_address;
|
|
151
|
+
|
|
152
|
+
// The destination CID, identifying the remote peer. This value is always
|
|
153
|
+
// provided by the remote peer.
|
|
154
|
+
CID dcid = CID::kInvalid;
|
|
155
|
+
|
|
156
|
+
// The source CID, identifying this session. This value is always created
|
|
157
|
+
// locally.
|
|
158
|
+
CID scid = CID::kInvalid;
|
|
159
|
+
|
|
160
|
+
// Used only by client sessions to identify the original DCID
|
|
161
|
+
// used to initiate the connection.
|
|
162
|
+
CID ocid = CID::kInvalid;
|
|
163
|
+
CID retry_scid = CID::kInvalid;
|
|
164
|
+
CID preferred_address_cid = CID::kInvalid;
|
|
165
|
+
|
|
166
|
+
ngtcp2_settings settings = {};
|
|
167
|
+
operator ngtcp2_settings*() { return &settings; }
|
|
168
|
+
operator const ngtcp2_settings*() const { return &settings; }
|
|
169
|
+
|
|
170
|
+
Config(Side side,
|
|
171
|
+
const Endpoint& endpoint,
|
|
172
|
+
const Options& options,
|
|
173
|
+
uint32_t version,
|
|
174
|
+
const SocketAddress& local_address,
|
|
175
|
+
const SocketAddress& remote_address,
|
|
176
|
+
const CID& dcid,
|
|
177
|
+
const CID& scid,
|
|
178
|
+
const CID& ocid = CID::kInvalid);
|
|
179
|
+
|
|
180
|
+
Config(const Endpoint& endpoint,
|
|
181
|
+
const Options& options,
|
|
182
|
+
const SocketAddress& local_address,
|
|
183
|
+
const SocketAddress& remote_address,
|
|
184
|
+
const CID& ocid = CID::kInvalid);
|
|
185
|
+
|
|
186
|
+
void set_token(const uint8_t* token,
|
|
187
|
+
size_t len,
|
|
188
|
+
ngtcp2_token_type type = NGTCP2_TOKEN_TYPE_UNKNOWN);
|
|
189
|
+
void set_token(const RetryToken& token);
|
|
190
|
+
void set_token(const RegularToken& token);
|
|
191
|
+
|
|
192
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
193
|
+
SET_MEMORY_INFO_NAME(Session::Config)
|
|
194
|
+
SET_SELF_SIZE(Config)
|
|
195
|
+
|
|
196
|
+
std::string ToString() const;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
static bool HasInstance(Environment* env, v8::Local<v8::Value> value);
|
|
200
|
+
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
|
|
201
|
+
Environment* env);
|
|
202
|
+
static void InitPerIsolate(IsolateData* isolate_data,
|
|
203
|
+
v8::Local<v8::ObjectTemplate> target);
|
|
204
|
+
static void InitPerContext(Realm* env, v8::Local<v8::Object> target);
|
|
205
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
206
|
+
|
|
207
|
+
static BaseObjectPtr<Session> Create(
|
|
208
|
+
Endpoint* endpoint,
|
|
209
|
+
const Config& config,
|
|
210
|
+
TLSContext* tls_context,
|
|
211
|
+
const std::optional<SessionTicket>& ticket);
|
|
212
|
+
|
|
213
|
+
// Really should be private but MakeDetachedBaseObject needs visibility.
|
|
214
|
+
Session(Endpoint* endpoint,
|
|
215
|
+
v8::Local<v8::Object> object,
|
|
216
|
+
const Config& config,
|
|
217
|
+
TLSContext* tls_context,
|
|
218
|
+
const std::optional<SessionTicket>& ticket);
|
|
219
|
+
~Session() override;
|
|
220
|
+
|
|
221
|
+
uint32_t version() const;
|
|
222
|
+
Endpoint& endpoint() const;
|
|
223
|
+
TLSSession& tls_session();
|
|
224
|
+
Application& application();
|
|
225
|
+
const Config& config() const;
|
|
226
|
+
const Options& options() const;
|
|
227
|
+
const SocketAddress& remote_address() const;
|
|
228
|
+
const SocketAddress& local_address() const;
|
|
229
|
+
|
|
230
|
+
bool is_closing() const;
|
|
231
|
+
bool is_graceful_closing() const;
|
|
232
|
+
bool is_silent_closing() const;
|
|
233
|
+
bool is_destroyed() const;
|
|
234
|
+
bool is_server() const;
|
|
235
|
+
|
|
236
|
+
size_t max_packet_size() const;
|
|
237
|
+
|
|
238
|
+
void set_priority_supported(bool on = true);
|
|
239
|
+
|
|
240
|
+
std::string diagnostic_name() const override;
|
|
241
|
+
|
|
242
|
+
// Use the configured CID::Factory to generate a new CID.
|
|
243
|
+
CID new_cid(size_t len = CID::kMaxLength) const;
|
|
244
|
+
|
|
245
|
+
void HandleQlog(uint32_t flags, const void* data, size_t len);
|
|
246
|
+
|
|
247
|
+
TransportParams GetLocalTransportParams() const;
|
|
248
|
+
TransportParams GetRemoteTransportParams() const;
|
|
249
|
+
void UpdatePacketTxTime();
|
|
250
|
+
|
|
251
|
+
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
252
|
+
SET_MEMORY_INFO_NAME(Session)
|
|
253
|
+
SET_SELF_SIZE(Session)
|
|
254
|
+
|
|
255
|
+
struct State;
|
|
256
|
+
struct Stats;
|
|
257
|
+
|
|
258
|
+
operator ngtcp2_conn*() const;
|
|
259
|
+
|
|
260
|
+
BaseObjectPtr<Stream> FindStream(int64_t id) const;
|
|
261
|
+
BaseObjectPtr<Stream> CreateStream(int64_t id);
|
|
262
|
+
BaseObjectPtr<Stream> OpenStream(Direction direction);
|
|
263
|
+
void ExtendStreamOffset(int64_t id, size_t amount);
|
|
264
|
+
void ExtendOffset(size_t amount);
|
|
265
|
+
void SetLastError(QuicError&& error);
|
|
266
|
+
uint64_t max_data_left() const;
|
|
267
|
+
|
|
268
|
+
enum class CloseMethod {
|
|
269
|
+
// Roundtrip through JavaScript, causing all currently opened streams
|
|
270
|
+
// to be closed. An attempt will be made to send a CONNECTION_CLOSE
|
|
271
|
+
// frame to the peer. If closing while within the ngtcp2 callback scope,
|
|
272
|
+
// sending the CONNECTION_CLOSE will be deferred until the scope exits.
|
|
273
|
+
DEFAULT,
|
|
274
|
+
// The connected peer will not be notified.
|
|
275
|
+
SILENT,
|
|
276
|
+
// Closing gracefully disables the ability to open or accept new streams for
|
|
277
|
+
// this Session. Existing streams are allowed to close naturally on their
|
|
278
|
+
// own.
|
|
279
|
+
// Once called, the Session will be immediately closed once there are no
|
|
280
|
+
// remaining streams. No notification is given to the connected peer that we
|
|
281
|
+
// are in a graceful closing state. A CONNECTION_CLOSE will be sent only
|
|
282
|
+
// once
|
|
283
|
+
// Close() is called.
|
|
284
|
+
GRACEFUL
|
|
285
|
+
};
|
|
286
|
+
void Close(CloseMethod method = CloseMethod::DEFAULT);
|
|
287
|
+
|
|
288
|
+
struct SendPendingDataScope {
|
|
289
|
+
Session* session;
|
|
290
|
+
explicit SendPendingDataScope(Session* session);
|
|
291
|
+
explicit SendPendingDataScope(const BaseObjectPtr<Session>& session);
|
|
292
|
+
DISALLOW_COPY_AND_MOVE(SendPendingDataScope)
|
|
293
|
+
~SendPendingDataScope();
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
private:
|
|
297
|
+
struct Impl;
|
|
298
|
+
struct MaybeCloseConnectionScope;
|
|
299
|
+
|
|
300
|
+
using StreamsMap = std::unordered_map<int64_t, BaseObjectPtr<Stream>>;
|
|
301
|
+
using QuicConnectionPointer = DeleteFnPtr<ngtcp2_conn, ngtcp2_conn_del>;
|
|
302
|
+
|
|
303
|
+
struct PathValidationFlags {
|
|
304
|
+
bool preferredAddress = false;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
struct DatagramReceivedFlags {
|
|
308
|
+
bool early = false;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
void Destroy();
|
|
312
|
+
|
|
313
|
+
bool Receive(Store&& store,
|
|
314
|
+
const SocketAddress& local_address,
|
|
315
|
+
const SocketAddress& remote_address);
|
|
316
|
+
|
|
317
|
+
void Send(Packet* packet);
|
|
318
|
+
void Send(Packet* packet, const PathStorage& path);
|
|
319
|
+
uint64_t SendDatagram(Store&& data);
|
|
320
|
+
|
|
321
|
+
void AddStream(const BaseObjectPtr<Stream>& stream);
|
|
322
|
+
void RemoveStream(int64_t id);
|
|
323
|
+
void ResumeStream(int64_t id);
|
|
324
|
+
void ShutdownStream(int64_t id, QuicError error);
|
|
325
|
+
void StreamDataBlocked(int64_t id);
|
|
326
|
+
void ShutdownStreamWrite(int64_t id, QuicError code = QuicError());
|
|
327
|
+
|
|
328
|
+
// Implementation of SessionTicket::AppData::Source
|
|
329
|
+
void CollectSessionTicketAppData(
|
|
330
|
+
SessionTicket::AppData* app_data) const override;
|
|
331
|
+
SessionTicket::AppData::Status ExtractSessionTicketAppData(
|
|
332
|
+
const SessionTicket::AppData& app_data,
|
|
333
|
+
SessionTicket::AppData::Source::Flag flag) override;
|
|
334
|
+
|
|
335
|
+
// Returns true if the Session has entered the closing period after sending a
|
|
336
|
+
// CONNECTION_CLOSE. While true, the Session is only permitted to transmit
|
|
337
|
+
// CONNECTION_CLOSE frames until either the idle timeout period elapses or
|
|
338
|
+
// until the Session is explicitly destroyed.
|
|
339
|
+
bool is_in_closing_period() const;
|
|
340
|
+
|
|
341
|
+
// Returns true if the Session has received a CONNECTION_CLOSE frame from the
|
|
342
|
+
// peer. Once in the draining period, the Session is not permitted to send any
|
|
343
|
+
// frames to the peer. The Session will be silently closed after either the
|
|
344
|
+
// idle timeout period elapses or until the Session is explicitly destroyed.
|
|
345
|
+
bool is_in_draining_period() const;
|
|
346
|
+
|
|
347
|
+
// Returns false if the Session is currently in a state where it is unable to
|
|
348
|
+
// transmit any packets.
|
|
349
|
+
bool can_send_packets() const;
|
|
350
|
+
|
|
351
|
+
// Returns false if the Session is currently in a state where it cannot create
|
|
352
|
+
// new streams.
|
|
353
|
+
bool can_create_streams() const;
|
|
354
|
+
uint64_t max_local_streams_uni() const;
|
|
355
|
+
uint64_t max_local_streams_bidi() const;
|
|
356
|
+
|
|
357
|
+
bool wants_session_ticket() const;
|
|
358
|
+
void SetStreamOpenAllowed();
|
|
359
|
+
|
|
360
|
+
// It's a terrible name but "wrapped" here means that the Session has been
|
|
361
|
+
// passed out to JavaScript and should be "wrapped" by whatever handler is
|
|
362
|
+
// defined there to manage it.
|
|
363
|
+
void set_wrapped();
|
|
364
|
+
|
|
365
|
+
void DoClose(bool silent = false);
|
|
366
|
+
void UpdateDataStats();
|
|
367
|
+
void SendConnectionClose();
|
|
368
|
+
void OnTimeout();
|
|
369
|
+
void UpdateTimer();
|
|
370
|
+
bool StartClosingPeriod();
|
|
371
|
+
|
|
372
|
+
// JavaScript callouts
|
|
373
|
+
|
|
374
|
+
void EmitClose(const QuicError& error = QuicError());
|
|
375
|
+
void EmitDatagram(Store&& datagram, DatagramReceivedFlags flag);
|
|
376
|
+
void EmitDatagramStatus(uint64_t id, DatagramStatus status);
|
|
377
|
+
void EmitHandshakeComplete();
|
|
378
|
+
void EmitKeylog(const char* line);
|
|
379
|
+
|
|
380
|
+
struct ValidatedPath {
|
|
381
|
+
std::shared_ptr<SocketAddress> local;
|
|
382
|
+
std::shared_ptr<SocketAddress> remote;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
void EmitPathValidation(PathValidationResult result,
|
|
386
|
+
PathValidationFlags flags,
|
|
387
|
+
const ValidatedPath& newPath,
|
|
388
|
+
const std::optional<ValidatedPath>& oldPath);
|
|
389
|
+
void EmitSessionTicket(Store&& ticket);
|
|
390
|
+
void EmitStream(BaseObjectPtr<Stream> stream);
|
|
391
|
+
void EmitVersionNegotiation(const ngtcp2_pkt_hd& hd,
|
|
392
|
+
const uint32_t* sv,
|
|
393
|
+
size_t nsv);
|
|
394
|
+
|
|
395
|
+
void DatagramStatus(uint64_t datagramId, DatagramStatus status);
|
|
396
|
+
void DatagramReceived(const uint8_t* data,
|
|
397
|
+
size_t datalen,
|
|
398
|
+
DatagramReceivedFlags flag);
|
|
399
|
+
bool GenerateNewConnectionId(ngtcp2_cid* cid, size_t len, uint8_t* token);
|
|
400
|
+
bool HandshakeCompleted();
|
|
401
|
+
void HandshakeConfirmed();
|
|
402
|
+
void SelectPreferredAddress(PreferredAddress* preferredAddress);
|
|
403
|
+
void UpdatePath(const PathStorage& path);
|
|
404
|
+
|
|
405
|
+
QuicConnectionPointer InitConnection();
|
|
406
|
+
|
|
407
|
+
std::unique_ptr<Application> select_application();
|
|
408
|
+
|
|
409
|
+
AliasedStruct<Stats> stats_;
|
|
410
|
+
AliasedStruct<State> state_;
|
|
411
|
+
ngtcp2_mem allocator_;
|
|
412
|
+
BaseObjectWeakPtr<Endpoint> endpoint_;
|
|
413
|
+
Config config_;
|
|
414
|
+
SocketAddress local_address_;
|
|
415
|
+
SocketAddress remote_address_;
|
|
416
|
+
QuicConnectionPointer connection_;
|
|
417
|
+
std::unique_ptr<TLSSession> tls_session_;
|
|
418
|
+
std::unique_ptr<Application> application_;
|
|
419
|
+
StreamsMap streams_;
|
|
420
|
+
TimerWrapHandle timer_;
|
|
421
|
+
size_t send_scope_depth_ = 0;
|
|
422
|
+
size_t connection_close_depth_ = 0;
|
|
423
|
+
QuicError last_error_;
|
|
424
|
+
Packet* conn_closebuf_;
|
|
425
|
+
BaseObjectPtr<LogStream> qlog_stream_;
|
|
426
|
+
BaseObjectPtr<LogStream> keylog_stream_;
|
|
427
|
+
|
|
428
|
+
friend class Application;
|
|
429
|
+
friend class DefaultApplication;
|
|
430
|
+
friend class Endpoint;
|
|
431
|
+
friend struct Impl;
|
|
432
|
+
friend struct MaybeCloseConnectionScope;
|
|
433
|
+
friend struct SendPendingDataScope;
|
|
434
|
+
friend class Stream;
|
|
435
|
+
friend class TLSContext;
|
|
436
|
+
friend class TLSSession;
|
|
437
|
+
friend class TransportParams;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
} // namespace node::quic
|
|
441
|
+
|
|
442
|
+
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
|
|
443
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|