@psnext/slingcli 3.3.20260911-1 → 3.3.20260914-1
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/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-VDBOM5UG.js → chunk-BRL3MDQL.js} +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js +79 -32
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +2 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +25 -8
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.browser.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.js +23 -8
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/assert/strict.d.ts +13 -56
- package/node_modules/@types/node/assert.d.ts +189 -190
- package/node_modules/@types/node/async_hooks.d.ts +151 -43
- package/node_modules/@types/node/buffer.buffer.d.ts +12 -13
- package/node_modules/@types/node/buffer.d.ts +103 -237
- package/node_modules/@types/node/child_process.d.ts +39 -154
- package/node_modules/@types/node/cluster.d.ts +238 -384
- package/node_modules/@types/node/console.d.ts +45 -404
- package/node_modules/@types/node/constants.d.ts +3 -10
- package/node_modules/@types/node/crypto.d.ts +1000 -1593
- package/node_modules/@types/node/dgram.d.ts +133 -81
- package/node_modules/@types/node/diagnostics_channel.d.ts +277 -59
- package/node_modules/@types/node/dns/promises.d.ts +9 -15
- package/node_modules/@types/node/dns.d.ts +136 -183
- package/node_modules/@types/node/domain.d.ts +12 -32
- package/node_modules/@types/node/events.d.ts +872 -840
- package/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/@types/node/fs/promises.d.ts +256 -85
- package/node_modules/@types/node/fs.d.ts +865 -525
- package/node_modules/@types/node/globals.d.ts +12 -34
- package/node_modules/@types/node/globals.typedarray.d.ts +63 -0
- package/node_modules/@types/node/http.d.ts +433 -312
- package/node_modules/@types/node/http2.d.ts +545 -891
- package/node_modules/@types/node/https.d.ts +64 -243
- package/node_modules/@types/node/index.d.ts +25 -7
- package/node_modules/@types/node/inspector/promises.d.ts +35 -0
- package/node_modules/@types/node/inspector.d.ts +70 -58
- package/node_modules/@types/node/inspector.generated.d.ts +764 -410
- package/node_modules/@types/node/module.d.ts +54 -219
- package/node_modules/@types/node/net.d.ts +208 -222
- package/node_modules/@types/node/os.d.ts +41 -49
- package/node_modules/@types/node/package.json +13 -3
- package/node_modules/@types/node/path/posix.d.ts +8 -0
- package/node_modules/@types/node/path/win32.d.ts +8 -0
- package/node_modules/@types/node/path.d.ts +119 -141
- package/node_modules/@types/node/perf_hooks.d.ts +339 -690
- package/node_modules/@types/node/process.d.ts +389 -205
- package/node_modules/@types/node/punycode.d.ts +3 -31
- package/node_modules/@types/node/querystring.d.ts +3 -16
- package/node_modules/@types/node/quic.d.ts +2153 -0
- package/node_modules/@types/node/readline/promises.d.ts +3 -6
- package/node_modules/@types/node/readline.d.ts +66 -152
- package/node_modules/@types/node/repl.d.ts +101 -109
- package/node_modules/@types/node/sea.d.ts +1 -116
- package/node_modules/@types/node/sqlite.d.ts +486 -68
- package/node_modules/@types/node/stream/consumers.d.ts +91 -15
- package/node_modules/@types/node/stream/iter.d.ts +452 -0
- package/node_modules/@types/node/stream/promises.d.ts +136 -15
- package/node_modules/@types/node/stream/web.d.ts +197 -454
- package/node_modules/@types/node/stream.d.ts +603 -491
- package/node_modules/@types/node/string_decoder.d.ts +3 -43
- package/node_modules/@types/node/test/reporters.d.ts +59 -0
- package/node_modules/@types/node/test.d.ts +513 -292
- package/node_modules/@types/node/timers/promises.d.ts +3 -18
- package/node_modules/@types/node/timers.d.ts +3 -141
- package/node_modules/@types/node/tls.d.ts +166 -257
- package/node_modules/@types/node/trace_events.d.ts +3 -97
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -8
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +2 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +26 -6
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +118 -0
- package/node_modules/@types/node/tty.d.ts +61 -43
- package/node_modules/@types/node/url.d.ts +156 -584
- package/node_modules/@types/node/util/types.d.ts +558 -0
- package/node_modules/@types/node/util.d.ts +170 -1099
- package/node_modules/@types/node/v8.d.ts +175 -36
- package/node_modules/@types/node/vfs.d.ts +211 -0
- package/node_modules/@types/node/vm.d.ts +292 -209
- package/node_modules/@types/node/wasi.d.ts +24 -74
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
- package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +15 -0
- package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/node_modules/@types/node/web-globals/events.d.ts +9 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +14 -0
- package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +3 -0
- package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +97 -0
- package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +257 -407
- package/node_modules/@types/node/zlib/iter.d.ts +131 -0
- package/node_modules/@types/node/zlib.d.ts +24 -165
- package/node_modules/undici-types/agent.d.ts +12 -13
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +13 -12
- package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +63 -37
- package/node_modules/undici-types/connector.d.ts +5 -2
- package/node_modules/undici-types/cookies.d.ts +3 -1
- package/node_modules/undici-types/diagnostics-channel.d.ts +18 -10
- package/node_modules/undici-types/dispatcher.d.ts +136 -139
- package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +4 -3
- package/node_modules/undici-types/errors.d.ts +92 -54
- package/node_modules/undici-types/eventsource.d.ts +9 -4
- package/node_modules/undici-types/fetch.d.ts +51 -25
- package/node_modules/undici-types/formdata.d.ts +7 -7
- package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici-types/global-origin.d.ts +5 -5
- package/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/node_modules/undici-types/handlers.d.ts +10 -9
- package/node_modules/undici-types/header.d.ts +162 -1
- package/node_modules/undici-types/index.d.ts +69 -47
- package/node_modules/undici-types/interceptors.d.ts +72 -9
- package/node_modules/undici-types/mock-agent.d.ts +36 -18
- package/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/undici-types/mock-client.d.ts +6 -4
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +26 -21
- package/node_modules/undici-types/mock-pool.d.ts +6 -4
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +0 -4
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +14 -14
- package/node_modules/undici-types/proxy-agent.d.ts +14 -6
- package/node_modules/undici-types/readable.d.ts +19 -16
- package/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/node_modules/undici-types/retry-handler.d.ts +19 -10
- package/node_modules/undici-types/round-robin-pool.d.ts +39 -0
- package/node_modules/undici-types/snapshot-agent.d.ts +113 -0
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/undici-types/util.d.ts +3 -3
- package/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/undici-types/webidl.d.ts +148 -30
- package/node_modules/undici-types/websocket.d.ts +48 -10
- package/node_modules/zod/README.md +2 -2
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +14 -30
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +1 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +2 -11
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -4
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +53 -137
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +70 -1
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +87 -35
- package/node_modules/zod/src/v4/core/api.ts +21 -29
- package/node_modules/zod/src/v4/core/checks.ts +61 -1
- package/node_modules/zod/src/v4/core/compile.ts +35 -24
- package/node_modules/zod/src/v4/core/core.ts +1 -3
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +9 -63
- package/node_modules/zod/src/v4/core/memoizer.ts +2 -5
- package/node_modules/zod/src/v4/core/regexes.ts +4 -0
- package/node_modules/zod/src/v4/core/schemas.ts +36 -109
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +177 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
- package/node_modules/zod/src/v4/core/to-json-schema.ts +1 -1
- package/node_modules/zod/src/v4/core/util.ts +0 -4
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/src/v4/core/visit.ts +0 -11
- package/node_modules/zod/src/v4/locales/ar.ts +1 -0
- package/node_modules/zod/src/v4/locales/az.ts +1 -0
- package/node_modules/zod/src/v4/locales/be.ts +1 -0
- package/node_modules/zod/src/v4/locales/bg.ts +1 -0
- package/node_modules/zod/src/v4/locales/bn.ts +1 -0
- package/node_modules/zod/src/v4/locales/ca.ts +1 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +1 -0
- package/node_modules/zod/src/v4/locales/cs.ts +1 -0
- package/node_modules/zod/src/v4/locales/da.ts +1 -0
- package/node_modules/zod/src/v4/locales/de.ts +1 -0
- package/node_modules/zod/src/v4/locales/el.ts +1 -0
- package/node_modules/zod/src/v4/locales/en.ts +1 -0
- package/node_modules/zod/src/v4/locales/eo.ts +1 -0
- package/node_modules/zod/src/v4/locales/es.ts +1 -0
- package/node_modules/zod/src/v4/locales/fa.ts +1 -0
- package/node_modules/zod/src/v4/locales/fi.ts +1 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +1 -0
- package/node_modules/zod/src/v4/locales/fr.ts +1 -0
- package/node_modules/zod/src/v4/locales/gu.ts +1 -0
- package/node_modules/zod/src/v4/locales/he.ts +1 -0
- package/node_modules/zod/src/v4/locales/hi.ts +1 -0
- package/node_modules/zod/src/v4/locales/hr.ts +1 -0
- package/node_modules/zod/src/v4/locales/hu.ts +1 -0
- package/node_modules/zod/src/v4/locales/hy.ts +1 -0
- package/node_modules/zod/src/v4/locales/id.ts +1 -0
- package/node_modules/zod/src/v4/locales/is.ts +1 -0
- package/node_modules/zod/src/v4/locales/it.ts +1 -0
- package/node_modules/zod/src/v4/locales/ja.ts +1 -0
- package/node_modules/zod/src/v4/locales/ka.ts +1 -0
- package/node_modules/zod/src/v4/locales/km.ts +1 -0
- package/node_modules/zod/src/v4/locales/kn.ts +1 -0
- package/node_modules/zod/src/v4/locales/ko.ts +1 -0
- package/node_modules/zod/src/v4/locales/lt.ts +1 -0
- package/node_modules/zod/src/v4/locales/mk.ts +1 -0
- package/node_modules/zod/src/v4/locales/ms.ts +1 -0
- package/node_modules/zod/src/v4/locales/ne.ts +1 -0
- package/node_modules/zod/src/v4/locales/nl.ts +1 -0
- package/node_modules/zod/src/v4/locales/nn.ts +1 -0
- package/node_modules/zod/src/v4/locales/no.ts +1 -0
- package/node_modules/zod/src/v4/locales/ota.ts +1 -0
- package/node_modules/zod/src/v4/locales/pl.ts +1 -0
- package/node_modules/zod/src/v4/locales/ps.ts +1 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +1 -0
- package/node_modules/zod/src/v4/locales/pt.ts +1 -0
- package/node_modules/zod/src/v4/locales/ro.ts +1 -0
- package/node_modules/zod/src/v4/locales/ru.ts +1 -0
- package/node_modules/zod/src/v4/locales/sk.ts +1 -0
- package/node_modules/zod/src/v4/locales/sl.ts +1 -0
- package/node_modules/zod/src/v4/locales/sv.ts +1 -0
- package/node_modules/zod/src/v4/locales/ta.ts +1 -0
- package/node_modules/zod/src/v4/locales/tg.ts +1 -0
- package/node_modules/zod/src/v4/locales/th.ts +1 -0
- package/node_modules/zod/src/v4/locales/tk.ts +1 -0
- package/node_modules/zod/src/v4/locales/tr.ts +1 -0
- package/node_modules/zod/src/v4/locales/uk.ts +1 -0
- package/node_modules/zod/src/v4/locales/ur.ts +1 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/locales/vi.ts +1 -0
- package/node_modules/zod/src/v4/locales/yo.ts +1 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +1 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +1 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +12 -23
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +56 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +7 -0
- package/node_modules/zod/v4/classic/checks.cjs +2 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/schemas.cjs +11 -15
- package/node_modules/zod/v4/classic/schemas.d.cts +4 -6
- package/node_modules/zod/v4/classic/schemas.d.ts +4 -6
- package/node_modules/zod/v4/classic/schemas.js +9 -13
- package/node_modules/zod/v4/core/api.cjs +11 -23
- package/node_modules/zod/v4/core/api.d.cts +8 -4
- package/node_modules/zod/v4/core/api.d.ts +8 -4
- package/node_modules/zod/v4/core/api.js +11 -23
- package/node_modules/zod/v4/core/checks.cjs +32 -1
- package/node_modules/zod/v4/core/checks.d.cts +16 -0
- package/node_modules/zod/v4/core/checks.d.ts +16 -0
- package/node_modules/zod/v4/core/checks.js +31 -0
- package/node_modules/zod/v4/core/compile.cjs +12 -17
- package/node_modules/zod/v4/core/compile.js +13 -18
- package/node_modules/zod/v4/core/core.cjs +1 -1
- package/node_modules/zod/v4/core/core.js +1 -1
- package/node_modules/zod/v4/core/json-schema-processors.cjs +8 -44
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -1
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -1
- package/node_modules/zod/v4/core/json-schema-processors.js +8 -43
- package/node_modules/zod/v4/core/memoizer.cjs +2 -5
- package/node_modules/zod/v4/core/memoizer.js +2 -5
- package/node_modules/zod/v4/core/regexes.cjs +4 -2
- package/node_modules/zod/v4/core/regexes.d.cts +1 -0
- package/node_modules/zod/v4/core/regexes.d.ts +1 -0
- package/node_modules/zod/v4/core/regexes.js +2 -0
- package/node_modules/zod/v4/core/schemas.cjs +33 -73
- package/node_modules/zod/v4/core/schemas.d.cts +7 -22
- package/node_modules/zod/v4/core/schemas.d.ts +7 -22
- package/node_modules/zod/v4/core/schemas.js +30 -72
- package/node_modules/zod/v4/core/to-json-schema.cjs +0 -1
- package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -3
- package/node_modules/zod/v4/core/to-json-schema.js +1 -1
- package/node_modules/zod/v4/core/util.cjs +0 -4
- package/node_modules/zod/v4/core/util.js +0 -4
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/node_modules/zod/v4/core/visit.cjs +0 -12
- package/node_modules/zod/v4/core/visit.js +0 -12
- package/node_modules/zod/v4/locales/ar.cjs +1 -0
- package/node_modules/zod/v4/locales/ar.js +1 -0
- package/node_modules/zod/v4/locales/az.cjs +1 -0
- package/node_modules/zod/v4/locales/az.js +1 -0
- package/node_modules/zod/v4/locales/be.cjs +1 -0
- package/node_modules/zod/v4/locales/be.js +1 -0
- package/node_modules/zod/v4/locales/bg.cjs +1 -0
- package/node_modules/zod/v4/locales/bg.js +1 -0
- package/node_modules/zod/v4/locales/bn.cjs +1 -0
- package/node_modules/zod/v4/locales/bn.js +1 -0
- package/node_modules/zod/v4/locales/ca.cjs +1 -0
- package/node_modules/zod/v4/locales/ca.js +1 -0
- package/node_modules/zod/v4/locales/ckb.cjs +1 -0
- package/node_modules/zod/v4/locales/ckb.js +1 -0
- package/node_modules/zod/v4/locales/cs.cjs +1 -0
- package/node_modules/zod/v4/locales/cs.js +1 -0
- package/node_modules/zod/v4/locales/da.cjs +1 -0
- package/node_modules/zod/v4/locales/da.js +1 -0
- package/node_modules/zod/v4/locales/de.cjs +1 -0
- package/node_modules/zod/v4/locales/de.js +1 -0
- package/node_modules/zod/v4/locales/el.cjs +1 -0
- package/node_modules/zod/v4/locales/el.js +1 -0
- package/node_modules/zod/v4/locales/en.cjs +1 -0
- package/node_modules/zod/v4/locales/en.js +1 -0
- package/node_modules/zod/v4/locales/eo.cjs +1 -0
- package/node_modules/zod/v4/locales/eo.js +1 -0
- package/node_modules/zod/v4/locales/es.cjs +1 -0
- package/node_modules/zod/v4/locales/es.js +1 -0
- package/node_modules/zod/v4/locales/fa.cjs +1 -0
- package/node_modules/zod/v4/locales/fa.js +1 -0
- package/node_modules/zod/v4/locales/fi.cjs +1 -0
- package/node_modules/zod/v4/locales/fi.js +1 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +1 -0
- package/node_modules/zod/v4/locales/fr-CA.js +1 -0
- package/node_modules/zod/v4/locales/fr.cjs +1 -0
- package/node_modules/zod/v4/locales/fr.js +1 -0
- package/node_modules/zod/v4/locales/gu.cjs +1 -0
- package/node_modules/zod/v4/locales/gu.js +1 -0
- package/node_modules/zod/v4/locales/he.cjs +1 -0
- package/node_modules/zod/v4/locales/he.js +1 -0
- package/node_modules/zod/v4/locales/hi.cjs +1 -0
- package/node_modules/zod/v4/locales/hi.js +1 -0
- package/node_modules/zod/v4/locales/hr.cjs +1 -0
- package/node_modules/zod/v4/locales/hr.js +1 -0
- package/node_modules/zod/v4/locales/hu.cjs +1 -0
- package/node_modules/zod/v4/locales/hu.js +1 -0
- package/node_modules/zod/v4/locales/hy.cjs +1 -0
- package/node_modules/zod/v4/locales/hy.js +1 -0
- package/node_modules/zod/v4/locales/id.cjs +1 -0
- package/node_modules/zod/v4/locales/id.js +1 -0
- package/node_modules/zod/v4/locales/is.cjs +1 -0
- package/node_modules/zod/v4/locales/is.js +1 -0
- package/node_modules/zod/v4/locales/it.cjs +1 -0
- package/node_modules/zod/v4/locales/it.js +1 -0
- package/node_modules/zod/v4/locales/ja.cjs +1 -0
- package/node_modules/zod/v4/locales/ja.js +1 -0
- package/node_modules/zod/v4/locales/ka.cjs +1 -0
- package/node_modules/zod/v4/locales/ka.js +1 -0
- package/node_modules/zod/v4/locales/km.cjs +1 -0
- package/node_modules/zod/v4/locales/km.js +1 -0
- package/node_modules/zod/v4/locales/kn.cjs +1 -0
- package/node_modules/zod/v4/locales/kn.js +1 -0
- package/node_modules/zod/v4/locales/ko.cjs +1 -0
- package/node_modules/zod/v4/locales/ko.js +1 -0
- package/node_modules/zod/v4/locales/lt.cjs +1 -0
- package/node_modules/zod/v4/locales/lt.js +1 -0
- package/node_modules/zod/v4/locales/mk.cjs +1 -0
- package/node_modules/zod/v4/locales/mk.js +1 -0
- package/node_modules/zod/v4/locales/ms.cjs +1 -0
- package/node_modules/zod/v4/locales/ms.js +1 -0
- package/node_modules/zod/v4/locales/ne.cjs +1 -0
- package/node_modules/zod/v4/locales/ne.js +1 -0
- package/node_modules/zod/v4/locales/nl.cjs +1 -0
- package/node_modules/zod/v4/locales/nl.js +1 -0
- package/node_modules/zod/v4/locales/nn.cjs +1 -0
- package/node_modules/zod/v4/locales/nn.js +1 -0
- package/node_modules/zod/v4/locales/no.cjs +1 -0
- package/node_modules/zod/v4/locales/no.js +1 -0
- package/node_modules/zod/v4/locales/ota.cjs +1 -0
- package/node_modules/zod/v4/locales/ota.js +1 -0
- package/node_modules/zod/v4/locales/pl.cjs +1 -0
- package/node_modules/zod/v4/locales/pl.js +1 -0
- package/node_modules/zod/v4/locales/ps.cjs +1 -0
- package/node_modules/zod/v4/locales/ps.js +1 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +1 -0
- package/node_modules/zod/v4/locales/pt-BR.js +1 -0
- package/node_modules/zod/v4/locales/pt.cjs +1 -0
- package/node_modules/zod/v4/locales/pt.js +1 -0
- package/node_modules/zod/v4/locales/ro.cjs +1 -0
- package/node_modules/zod/v4/locales/ro.js +1 -0
- package/node_modules/zod/v4/locales/ru.cjs +1 -0
- package/node_modules/zod/v4/locales/ru.js +1 -0
- package/node_modules/zod/v4/locales/sk.cjs +1 -0
- package/node_modules/zod/v4/locales/sk.js +1 -0
- package/node_modules/zod/v4/locales/sl.cjs +1 -0
- package/node_modules/zod/v4/locales/sl.js +1 -0
- package/node_modules/zod/v4/locales/sv.cjs +1 -0
- package/node_modules/zod/v4/locales/sv.js +1 -0
- package/node_modules/zod/v4/locales/ta.cjs +1 -0
- package/node_modules/zod/v4/locales/ta.js +1 -0
- package/node_modules/zod/v4/locales/tg.cjs +1 -0
- package/node_modules/zod/v4/locales/tg.js +1 -0
- package/node_modules/zod/v4/locales/th.cjs +1 -0
- package/node_modules/zod/v4/locales/th.js +1 -0
- package/node_modules/zod/v4/locales/tk.cjs +1 -0
- package/node_modules/zod/v4/locales/tk.js +1 -0
- package/node_modules/zod/v4/locales/tr.cjs +1 -0
- package/node_modules/zod/v4/locales/tr.js +1 -0
- package/node_modules/zod/v4/locales/uk.cjs +1 -0
- package/node_modules/zod/v4/locales/uk.js +1 -0
- package/node_modules/zod/v4/locales/ur.cjs +1 -0
- package/node_modules/zod/v4/locales/ur.js +1 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/locales/vi.cjs +1 -0
- package/node_modules/zod/v4/locales/vi.js +1 -0
- package/node_modules/zod/v4/locales/yo.cjs +1 -0
- package/node_modules/zod/v4/locales/yo.js +1 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +1 -0
- package/node_modules/zod/v4/locales/zh-CN.js +1 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +1 -0
- package/node_modules/zod/v4/locales/zh-TW.js +1 -0
- package/node_modules/zod/v4/mini/checks.cjs +2 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +11 -13
- package/node_modules/zod/v4/mini/schemas.d.cts +1 -4
- package/node_modules/zod/v4/mini/schemas.d.ts +1 -4
- package/node_modules/zod/v4/mini/schemas.js +9 -11
- package/package.json +2 -2
- package/slingshot/index.js +183 -182
- package/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
- package/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
- package/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
- package/node_modules/undici-types/file.d.ts +0 -39
- package/node_modules/undici-types/filereader.d.ts +0 -54
|
@@ -0,0 +1,2153 @@
|
|
|
1
|
+
declare module "node:quic" {
|
|
2
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
3
|
+
import { KeyObject, X509Certificate } from "node:crypto";
|
|
4
|
+
import { FileHandle } from "node:fs/promises";
|
|
5
|
+
import { BlockList, SocketAddress } from "node:net";
|
|
6
|
+
import { Writer } from "node:stream/iter";
|
|
7
|
+
import { EphemeralKeyInfo } from "node:tls";
|
|
8
|
+
/**
|
|
9
|
+
* @since v23.8.0
|
|
10
|
+
*/
|
|
11
|
+
type OnSessionCallback = (this: QuicEndpoint, session: QuicSession) => void;
|
|
12
|
+
/**
|
|
13
|
+
* @since v23.8.0
|
|
14
|
+
*/
|
|
15
|
+
type OnStreamCallback = (this: QuicSession, stream: QuicStream) => void;
|
|
16
|
+
/**
|
|
17
|
+
* @since v23.8.0
|
|
18
|
+
*/
|
|
19
|
+
type OnDatagramCallback = (this: QuicSession, datagram: NodeJS.NonSharedUint8Array, early: boolean) => void;
|
|
20
|
+
/**
|
|
21
|
+
* @since v23.8.0
|
|
22
|
+
*/
|
|
23
|
+
type OnDatagramStatusCallback = (
|
|
24
|
+
this: QuicSession,
|
|
25
|
+
id: bigint,
|
|
26
|
+
status: "acknowledged" | "lost" | "abandoned",
|
|
27
|
+
) => void;
|
|
28
|
+
/**
|
|
29
|
+
* @since v23.8.0
|
|
30
|
+
*/
|
|
31
|
+
type OnApplicationCallback = (this: QuicSession, applicationoptions: SessionApplicationOptions) => void;
|
|
32
|
+
/**
|
|
33
|
+
* @since v23.8.0
|
|
34
|
+
*/
|
|
35
|
+
type OnPathValidationCallback = (
|
|
36
|
+
this: QuicSession,
|
|
37
|
+
result: "success" | "failure" | "aborted",
|
|
38
|
+
newLocalAddress: SocketAddress,
|
|
39
|
+
newRemoteAddress: SocketAddress,
|
|
40
|
+
oldLocalAddress: SocketAddress | null,
|
|
41
|
+
oldRemoteAddress: SocketAddress | null,
|
|
42
|
+
preferredAddress: boolean,
|
|
43
|
+
) => void;
|
|
44
|
+
/**
|
|
45
|
+
* @since v23.8.0
|
|
46
|
+
*/
|
|
47
|
+
type OnSessionTicketCallback = (this: QuicSession, ticket: object) => void;
|
|
48
|
+
/**
|
|
49
|
+
* @since v23.8.0
|
|
50
|
+
*/
|
|
51
|
+
type OnVersionNegotiationCallback = (
|
|
52
|
+
this: QuicSession,
|
|
53
|
+
version: number,
|
|
54
|
+
requestedVersions: number[],
|
|
55
|
+
supportedVersions: number[],
|
|
56
|
+
) => void;
|
|
57
|
+
/**
|
|
58
|
+
* @since v23.8.0
|
|
59
|
+
*/
|
|
60
|
+
type OnHandshakeCallback = (this: QuicSession, info: SessionHandshakeInfo) => void;
|
|
61
|
+
/**
|
|
62
|
+
* @since v26.2.0
|
|
63
|
+
*/
|
|
64
|
+
type OnNewTokenCallback = (this: QuicSession, token: NonSharedBuffer, address: SocketAddress) => void;
|
|
65
|
+
/**
|
|
66
|
+
* @since v26.2.0
|
|
67
|
+
*/
|
|
68
|
+
type OnOriginCallback = (this: QuicSession, origins: string[]) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Called when TLS key material is available. Only fires when
|
|
71
|
+
* `sessionOptions.keylog` is `true`. Multiple lines are emitted during the
|
|
72
|
+
* TLS 1.3 handshake, each containing a secret label, the client random, and
|
|
73
|
+
* the secret value.
|
|
74
|
+
* @since v26.2.0
|
|
75
|
+
*/
|
|
76
|
+
type OnKeylogCallback = (this: QuicSession, line: string) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Called when qlog diagnostic data is available. Only fires when
|
|
79
|
+
* `sessionOptions.qlog` is `true`. The `data` chunks should be
|
|
80
|
+
* concatenated in order to produce the complete qlog output. When `fin` is
|
|
81
|
+
* `true`, no more chunks will be emitted and the concatenated result is a
|
|
82
|
+
* complete JSON-SEQ document.
|
|
83
|
+
* @since v26.2.0
|
|
84
|
+
*/
|
|
85
|
+
type OnQlogCallback = (this: QuicSession, data: string, fin: boolean) => void;
|
|
86
|
+
/**
|
|
87
|
+
* @since v23.8.0
|
|
88
|
+
*/
|
|
89
|
+
type OnBlockedCallback = (this: QuicStream) => void;
|
|
90
|
+
/**
|
|
91
|
+
* @since v23.8.0
|
|
92
|
+
*/
|
|
93
|
+
type OnStreamErrorCallback = (this: QuicStream, error: any) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Called when initial request or response headers are received. For HTTP/3,
|
|
96
|
+
* this delivers request pseudo-headers on the server and response headers
|
|
97
|
+
* on the client.
|
|
98
|
+
* @since v26.2.0
|
|
99
|
+
*/
|
|
100
|
+
type OnHeadersCallback = (this: QuicStream, headers: NodeJS.Dict<string | string[]>) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Called when trailing headers are received from the peer.
|
|
103
|
+
* @since v26.2.0
|
|
104
|
+
*/
|
|
105
|
+
type OnTrailersCallback = (this: QuicStream, trailers: NodeJS.Dict<string | string[]>) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Called when informational (1xx) headers are received from the server
|
|
108
|
+
* (e.g., 103 Early Hints).
|
|
109
|
+
* @since v26.2.0
|
|
110
|
+
*/
|
|
111
|
+
type OnInfoCallback = (this: QuicStream, headers: NodeJS.Dict<string | string[]>) => void;
|
|
112
|
+
/**
|
|
113
|
+
* @since v23.8.0
|
|
114
|
+
*/
|
|
115
|
+
interface TransportParams {
|
|
116
|
+
/**
|
|
117
|
+
* The preferred IPv4 address to advertise (only used by servers).
|
|
118
|
+
* @since v23.8.0
|
|
119
|
+
*/
|
|
120
|
+
preferredAddressIpv4?: SocketAddress | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* The preferred IPv6 address to advertise (only used by servers)
|
|
123
|
+
* @since v23.8.0
|
|
124
|
+
*/
|
|
125
|
+
preferredAddressIpv6?: SocketAddress | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* @since v23.8.0
|
|
128
|
+
*/
|
|
129
|
+
initialMaxStreamDataBidiLocal?: bigint | number | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* @since v23.8.0
|
|
132
|
+
*/
|
|
133
|
+
initialMaxStreamDataBidiRemote?: bigint | number | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* @since v23.8.0
|
|
136
|
+
*/
|
|
137
|
+
initialMaxStreamDataUni?: bigint | number | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* @since v23.8.0
|
|
140
|
+
*/
|
|
141
|
+
initialMaxData?: bigint | number | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* @since v23.8.0
|
|
144
|
+
*/
|
|
145
|
+
initialMaxStreamsBidi?: bigint | number | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* @since v23.8.0
|
|
148
|
+
*/
|
|
149
|
+
initialMaxStreamsUni?: bigint | number | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* @since v23.8.0
|
|
152
|
+
*/
|
|
153
|
+
maxIdleTimeout?: bigint | number | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* @since v23.8.0
|
|
156
|
+
*/
|
|
157
|
+
activeConnectionIDLimit?: bigint | number | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* @since v23.8.0
|
|
160
|
+
*/
|
|
161
|
+
ackDelayExponent?: bigint | number | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* @since v23.8.0
|
|
164
|
+
*/
|
|
165
|
+
maxAckDelay?: bigint | number | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* The maximum size in bytes of a DATAGRAM frame payload that this endpoint
|
|
168
|
+
* is willing to receive. Set to `0` to disable datagram support. The peer
|
|
169
|
+
* will not send datagrams larger than this value. The actual maximum size of
|
|
170
|
+
* a datagram that can be _sent_ is determined by the peer's
|
|
171
|
+
* `maxDatagramFrameSize`, not this endpoint's value.
|
|
172
|
+
* @since v23.8.0
|
|
173
|
+
*/
|
|
174
|
+
maxDatagramFrameSize?: bigint | number | undefined;
|
|
175
|
+
}
|
|
176
|
+
interface SNIEntry {
|
|
177
|
+
/**
|
|
178
|
+
* The TLS private keys. **Required.**
|
|
179
|
+
*/
|
|
180
|
+
keys: KeyObject | readonly KeyObject[];
|
|
181
|
+
/**
|
|
182
|
+
* The TLS certificates. **Required.**
|
|
183
|
+
*/
|
|
184
|
+
certs: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView>;
|
|
185
|
+
/**
|
|
186
|
+
* Verify the private key. Default: `false`.
|
|
187
|
+
*/
|
|
188
|
+
verifyPrivateKey?: boolean | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* The port to advertise in ORIGIN frames (RFC 9412) for this host name. **Default:** `443`. Only used for HTTP/3 sessions.
|
|
191
|
+
*/
|
|
192
|
+
port?: number | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Whether to include this host name in ORIGIN frames. **Default:** `true`. Set to `false` to exclude a host name
|
|
195
|
+
* from ORIGIN advertisements. Wildcard (`'*'`) entries are always excluded regardless of this setting.
|
|
196
|
+
*/
|
|
197
|
+
authoritative?: boolean | undefined;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @since v26.3.0
|
|
201
|
+
*/
|
|
202
|
+
interface ApplicationOptions {
|
|
203
|
+
/**
|
|
204
|
+
* Maximum number of header name-value pairs accepted per header block.
|
|
205
|
+
* Headers beyond this limit are silently dropped. **Default:** `128`
|
|
206
|
+
*/
|
|
207
|
+
maxHeaderPairs?: bigint | number | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* Maximum total byte length of all header names and values combined per header
|
|
210
|
+
* block. Headers that would push the total over this limit are silently
|
|
211
|
+
* dropped. **Default:** `8192`
|
|
212
|
+
*/
|
|
213
|
+
maxHeaderLength?: bigint | number | undefined;
|
|
214
|
+
/**
|
|
215
|
+
* Maximum size of a compressed header field section (QPACK). `0` means
|
|
216
|
+
* unlimited. **Default:** `0`
|
|
217
|
+
*/
|
|
218
|
+
maxFieldSectionSize?: bigint | number | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* QPACK dynamic table capacity in bytes. Set to `0` to disable the dynamic
|
|
221
|
+
* table. **Default:** `4096`
|
|
222
|
+
*/
|
|
223
|
+
qpackMaxDTableCapacity?: bigint | number | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* QPACK encoder maximum dynamic table capacity. **Default:** `4096`
|
|
226
|
+
*/
|
|
227
|
+
qpackEncoderMaxDTableCapacity?: bigint | number | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* Maximum number of streams that can e blocked waiting for QPACK dynamic table
|
|
230
|
+
* updates. **Default:** `100`
|
|
231
|
+
*/
|
|
232
|
+
qpackBlockedStreams?: bigint | number | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* Enable the extended CONNECT protocol (RFC 9220). **Default:** `false`
|
|
235
|
+
*/
|
|
236
|
+
enableConnectProtocol?: boolean | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* Enable HTTP/3 datagrams (RFC 9297). **Default:** `false`
|
|
239
|
+
*/
|
|
240
|
+
enableDatagrams?: boolean | undefined;
|
|
241
|
+
}
|
|
242
|
+
type SessionApplicationOptions = { [K in keyof ApplicationOptions]-?: ApplicationOptions[K] & (bigint | boolean) };
|
|
243
|
+
/**
|
|
244
|
+
* @since v23.8.0
|
|
245
|
+
*/
|
|
246
|
+
interface SessionOptions {
|
|
247
|
+
/**
|
|
248
|
+
* An endpoint to use.
|
|
249
|
+
* @since v23.8.0
|
|
250
|
+
*/
|
|
251
|
+
endpoint?: EndpointOptions | QuicEndpoint | undefined;
|
|
252
|
+
/**
|
|
253
|
+
* The ALPN (Application-Layer Protocol Negotiation) identifier(s).
|
|
254
|
+
*
|
|
255
|
+
* For **client** sessions, this is a single string specifying the protocol
|
|
256
|
+
* the client wants to use (e.g. `'h3'`).
|
|
257
|
+
*
|
|
258
|
+
* For **server** sessions, this is an array of protocol names in preference
|
|
259
|
+
* order that the server supports (e.g. `['h3', 'h3-29']`). During the TLS
|
|
260
|
+
* handshake, the server selects the first protocol from its list that the
|
|
261
|
+
* client also supports.
|
|
262
|
+
*
|
|
263
|
+
* The negotiated ALPN determines which Application implementation is used
|
|
264
|
+
* for the session. `'h3'` and `'h3-*'` variants select the HTTP/3
|
|
265
|
+
* application; all other values select the default application.
|
|
266
|
+
* @since v26.1.0
|
|
267
|
+
*/
|
|
268
|
+
alpn?: string | readonly string[] | undefined;
|
|
269
|
+
/**
|
|
270
|
+
* Application-specific options.
|
|
271
|
+
* @since v26.2.0
|
|
272
|
+
*/
|
|
273
|
+
application?: ApplicationOptions | undefined;
|
|
274
|
+
/**
|
|
275
|
+
* The CA certificates to use for client sessions. For server sessions, CA
|
|
276
|
+
* certificates are specified per-identity in the `sessionOptions.sni` map.
|
|
277
|
+
* @since v23.8.0
|
|
278
|
+
*/
|
|
279
|
+
ca?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Specifies the congestion control algorithm that will be used.
|
|
282
|
+
* Must be set to one of either `'reno'`, `'cubic'`, or `'bbr'`.
|
|
283
|
+
*
|
|
284
|
+
* This is an advanced option that users typically won't have need to specify.
|
|
285
|
+
* @since v23.8.0
|
|
286
|
+
*/
|
|
287
|
+
cc?: `${constants.cc}` | undefined;
|
|
288
|
+
/**
|
|
289
|
+
* The TLS certificates to use for client sessions. For server sessions,
|
|
290
|
+
* certificates are specified per-identity in the `sessionOptions.sni` map.
|
|
291
|
+
* @since v23.8.0
|
|
292
|
+
*/
|
|
293
|
+
certs?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* The list of supported TLS 1.3 cipher algorithms.
|
|
296
|
+
* @since v23.8.0
|
|
297
|
+
*/
|
|
298
|
+
ciphers?: string | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* The CRL to use for client sessions. For server sessions, CRLs are specified
|
|
301
|
+
* per-identity in the `sessionOptions.sni` map.
|
|
302
|
+
* @since v23.8.0
|
|
303
|
+
*/
|
|
304
|
+
crl?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
|
|
305
|
+
/**
|
|
306
|
+
* When `true`, enables TLS 0-RTT early data for this session. Early data
|
|
307
|
+
* allows the client to send application data before the TLS handshake
|
|
308
|
+
* completes, reducing latency on reconnection when a valid session ticket
|
|
309
|
+
* is available. Set to `false` to disable early data support.
|
|
310
|
+
* @since v26.2.0
|
|
311
|
+
*/
|
|
312
|
+
enableEarlyData?: boolean | undefined;
|
|
313
|
+
/**
|
|
314
|
+
* The list of supported TLS 1.3 cipher groups.
|
|
315
|
+
* @since v23.8.0
|
|
316
|
+
*/
|
|
317
|
+
groups?: string | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* When `true`, enables TLS key logging for the session. Key material is
|
|
320
|
+
* delivered to the `session.onkeylog` callback in [NSS Key Log Format](https://udn.realityripple.com/docs/Mozilla/Projects/NSS/Key_Log_Format).
|
|
321
|
+
* Each callback invocation receives a single line of key material. The output
|
|
322
|
+
* can be used with tools such as Wireshark to decrypt captured QUIC traffic.
|
|
323
|
+
* @since v23.8.0
|
|
324
|
+
*/
|
|
325
|
+
keylog?: boolean | undefined;
|
|
326
|
+
/**
|
|
327
|
+
* The TLS crypto keys to use for client sessions. For server sessions,
|
|
328
|
+
* keys are specified per-identity in the `sessionOptions.sni` map.
|
|
329
|
+
* @since v23.8.0
|
|
330
|
+
*/
|
|
331
|
+
keys?: KeyObject | readonly KeyObject[] | undefined;
|
|
332
|
+
/**
|
|
333
|
+
* Specifies the maximum UDP packet payload size.
|
|
334
|
+
* @since v23.8.0
|
|
335
|
+
*/
|
|
336
|
+
maxPayloadSize?: bigint | number | undefined;
|
|
337
|
+
/**
|
|
338
|
+
* Specifies the maximum stream flow-control window size.
|
|
339
|
+
* @since v23.8.0
|
|
340
|
+
*/
|
|
341
|
+
maxStreamWindow?: bigint | number | undefined;
|
|
342
|
+
/**
|
|
343
|
+
* Specifies the maximum session flow-control window size.
|
|
344
|
+
* @since v23.8.0
|
|
345
|
+
*/
|
|
346
|
+
maxWindow?: bigint | number | undefined;
|
|
347
|
+
/**
|
|
348
|
+
* The minimum QUIC version number to allow. This is an advanced option that users
|
|
349
|
+
* typically won't have need to specify.
|
|
350
|
+
* @since v23.8.0
|
|
351
|
+
*/
|
|
352
|
+
minVersion?: number | undefined;
|
|
353
|
+
/**
|
|
354
|
+
* When the remote peer advertises a preferred address, this option specifies whether
|
|
355
|
+
* to use it or ignore it. The default is `'ignore'` because honoring a server's
|
|
356
|
+
* preferred address causes the client to migrate its connection to a different IP
|
|
357
|
+
* address, which can be exploited for data exfiltration attacks that are
|
|
358
|
+
* indistinguishable from legitimate QUIC connection migration at the network level.
|
|
359
|
+
* Set to `'use'` only when connecting to trusted servers that require preferred
|
|
360
|
+
* address migration.
|
|
361
|
+
* @since v23.8.0
|
|
362
|
+
*/
|
|
363
|
+
preferredAddressPolicy?: "use" | "ignore" | "default" | undefined;
|
|
364
|
+
/**
|
|
365
|
+
* When `true`, enables [qlog](https://datatracker.ietf.org/doc/draft-ietf-quic-qlog-main-schema/) diagnostic output for the session. Qlog data
|
|
366
|
+
* is delivered to the `session.onqlog` callback as chunks of [JSON-SEQ](https://www.rfc-editor.org/rfc/rfc7464)
|
|
367
|
+
* formatted text. The output can be analyzed with qlog visualization tools
|
|
368
|
+
* such as [qvis](https://qvis.quictools.info/).
|
|
369
|
+
* @since v23.8.0
|
|
370
|
+
*/
|
|
371
|
+
qlog?: boolean | undefined;
|
|
372
|
+
/**
|
|
373
|
+
* A session ticket to use for 0RTT session resumption.
|
|
374
|
+
* @since v23.8.0
|
|
375
|
+
*/
|
|
376
|
+
sessionTicket?: NodeJS.ArrayBufferView | undefined;
|
|
377
|
+
/**
|
|
378
|
+
* Controls which datagram to drop when the pending datagram queue
|
|
379
|
+
* (sized by `session.maxPendingDatagrams`) is full. Must be one of
|
|
380
|
+
* `'drop-oldest'` (discard the oldest queued datagram to make room) or
|
|
381
|
+
* `'drop-newest'` (reject the incoming datagram). Dropped datagrams are
|
|
382
|
+
* reported as lost via the `ondatagramstatus` callback.
|
|
383
|
+
*
|
|
384
|
+
* This option is immutable after session creation.
|
|
385
|
+
* @since v26.2.0
|
|
386
|
+
*/
|
|
387
|
+
datagramDropPolicy?: "drop-oldest" | "drop-newest" | undefined;
|
|
388
|
+
/**
|
|
389
|
+
* The maximum time in milliseconds that a peer-initiated stream can be idle
|
|
390
|
+
* (no data received) before it is automatically destroyed. This protects
|
|
391
|
+
* against slowloris-style attacks where a remote peer opens streams but never
|
|
392
|
+
* sends data, holding server resources indefinitely. Only peer-initiated
|
|
393
|
+
* streams are checked — locally-initiated streams are the application's
|
|
394
|
+
* responsibility. Set to `0` to disable.
|
|
395
|
+
*
|
|
396
|
+
* The idle check runs as part of the normal send processing loop, so it adds
|
|
397
|
+
* no additional timers or event loop overhead. The
|
|
398
|
+
* `session.stats.streamsIdleTimedOut` counter tracks how many streams have been
|
|
399
|
+
* destroyed by this mechanism.
|
|
400
|
+
* @since v26.3.0
|
|
401
|
+
*/
|
|
402
|
+
streamIdleTimeout?: bigint | number | undefined;
|
|
403
|
+
/**
|
|
404
|
+
* The maximum number of `SendPendingData` cycles a datagram can survive
|
|
405
|
+
* without being sent before it is abandoned. When a datagram cannot be
|
|
406
|
+
* sent due to congestion control or packet size constraints, it remains
|
|
407
|
+
* in the queue and the attempt counter increments. Once the limit is
|
|
408
|
+
* reached, the datagram is dropped and reported as `'abandoned'` via the
|
|
409
|
+
* `ondatagramstatus` callback. Valid range: `1` to `255`.
|
|
410
|
+
* @since v26.2.0
|
|
411
|
+
*/
|
|
412
|
+
maxDatagramSendAttempts?: number | undefined;
|
|
413
|
+
/**
|
|
414
|
+
* A multiplier applied to the Probe Timeout (PTO) to compute the draining
|
|
415
|
+
* period duration after receiving a `CONNECTION_CLOSE` frame from the peer.
|
|
416
|
+
* RFC 9000 Section 10.2 requires the draining period to persist for at least
|
|
417
|
+
* three times the current PTO. The valid range is `3` to `255`. Values below
|
|
418
|
+
* `3` are clamped to `3`.
|
|
419
|
+
* @since v26.2.0
|
|
420
|
+
*/
|
|
421
|
+
drainingPeriodMultiplier?: number | undefined;
|
|
422
|
+
/**
|
|
423
|
+
* Specifies the keep-alive timeout in milliseconds. When set to a non-zero
|
|
424
|
+
* value, PING frames will be sent automatically to keep the connection alive
|
|
425
|
+
* before the idle timeout fires. The value should be less than the effective
|
|
426
|
+
* idle timeout (`maxIdleTimeout` transport parameter) to be useful.
|
|
427
|
+
* @since v23.8.0
|
|
428
|
+
*/
|
|
429
|
+
handshakeTimeout?: bigint | number | undefined;
|
|
430
|
+
/**
|
|
431
|
+
* Controls how the client handles server certificate validation:
|
|
432
|
+
*
|
|
433
|
+
* * `'strict'` — OpenSSL aborts the TLS handshake immediately if the server's
|
|
434
|
+
* certificate fails validation. The `session.opened` promise rejects with a
|
|
435
|
+
* TLS error. The application cannot inspect the certificate or the error
|
|
436
|
+
* details. This is the most secure mode.
|
|
437
|
+
*
|
|
438
|
+
* * `'auto'` — The TLS handshake completes regardless of validation result.
|
|
439
|
+
* If validation fails, the `session.opened` promise is rejected with an error
|
|
440
|
+
* containing the validation reason, and the session is destroyed. The
|
|
441
|
+
* `onhandshake` callback (if set) fires before rejection, allowing diagnostic
|
|
442
|
+
* logging. This is the default and matches the behavior of `tls.connect()`
|
|
443
|
+
* with `rejectUnauthorized: true`.
|
|
444
|
+
*
|
|
445
|
+
* * `'manual'` — The TLS handshake completes regardless of validation result.
|
|
446
|
+
* The `session.opened` promise resolves with the handshake info, which includes
|
|
447
|
+
* `validationErrorReason` and `validationErrorCode` if validation failed. The
|
|
448
|
+
* application is responsible for checking these values and deciding whether to
|
|
449
|
+
* continue. Use this mode for custom validation logic, certificate pinning, or
|
|
450
|
+
* intentionally accepting self-signed certificates.
|
|
451
|
+
* @since v26.3.0
|
|
452
|
+
*/
|
|
453
|
+
verifyPeer?: "strict" | "auto" | "manual" | undefined;
|
|
454
|
+
/**
|
|
455
|
+
* The peer server name to target (SNI). Defaults to `'localhost'`.
|
|
456
|
+
* @since v26.1.0
|
|
457
|
+
*/
|
|
458
|
+
servername?: string | undefined;
|
|
459
|
+
/**
|
|
460
|
+
* An object mapping host names to TLS identity options for Server Name
|
|
461
|
+
* Indication (SNI) support. This is required for server sessions and must
|
|
462
|
+
* contain at least one entry. The special key `'*'` specifies the optional
|
|
463
|
+
* default/fallback identity used when no other host name matches. If no
|
|
464
|
+
* wildcard entry is provided, connections with unrecognized server names
|
|
465
|
+
* will be rejected with a TLS `unrecognized_name` alert. Each entry may
|
|
466
|
+
* contain:
|
|
467
|
+
* @since v26.1.0
|
|
468
|
+
*/
|
|
469
|
+
sni?: Record<string, SNIEntry> | undefined;
|
|
470
|
+
/**
|
|
471
|
+
* True to enable TLS tracing output.
|
|
472
|
+
* @since v23.8.0
|
|
473
|
+
*/
|
|
474
|
+
tlsTrace?: boolean | undefined;
|
|
475
|
+
/**
|
|
476
|
+
* An opaque address validation token previously received from the server
|
|
477
|
+
* via the `session.onnewtoken` callback. Providing a valid token on
|
|
478
|
+
* reconnection allows the client to skip the server's address validation,
|
|
479
|
+
* reducing handshake latency.
|
|
480
|
+
* @since v26.2.0
|
|
481
|
+
*/
|
|
482
|
+
token?: NodeJS.ArrayBufferView | undefined;
|
|
483
|
+
/**
|
|
484
|
+
* The QUIC transport parameters to use for the session.
|
|
485
|
+
* @since v23.8.0
|
|
486
|
+
*/
|
|
487
|
+
transportParams?: TransportParams | undefined;
|
|
488
|
+
/**
|
|
489
|
+
* Specifies the maximum number of unacknowledged packets a session should allow.
|
|
490
|
+
* @since v23.8.0
|
|
491
|
+
*/
|
|
492
|
+
unacknowledgedPacketThreshold?: bigint | number | undefined;
|
|
493
|
+
/**
|
|
494
|
+
* If `true`, the peer certificate is verified against the list of supplied CAs.
|
|
495
|
+
* An error is emitted if verification fails; the error can be inspected via
|
|
496
|
+
* the `validationErrorReason` and `validationErrorCode` fields in the
|
|
497
|
+
* handshake callback. If `false`, peer certificate verification errors are
|
|
498
|
+
* ignored.
|
|
499
|
+
*/
|
|
500
|
+
rejectUnauthorized?: boolean | undefined;
|
|
501
|
+
/**
|
|
502
|
+
* When `true` (the default), `connect()` will attempt to reuse an existing
|
|
503
|
+
* endpoint rather than creating a new one for each session. This provides
|
|
504
|
+
* connection pooling behavior — multiple sessions can share a single UDP
|
|
505
|
+
* socket. The reuse logic will not return an endpoint that is listening on
|
|
506
|
+
* the same address as the connect target (to prevent CID routing conflicts).
|
|
507
|
+
*
|
|
508
|
+
* Set to `false` to force creation of a new endpoint for the session. This
|
|
509
|
+
* is useful when endpoint isolation is required (e.g., testing stateless
|
|
510
|
+
* reset behavior where source port identity matters).
|
|
511
|
+
* @since v26.2.0
|
|
512
|
+
*/
|
|
513
|
+
reuseEndpoint?: boolean | undefined;
|
|
514
|
+
/**
|
|
515
|
+
* True to require verification of TLS client certificate.
|
|
516
|
+
* @since v23.8.0
|
|
517
|
+
*/
|
|
518
|
+
verifyClient?: boolean | undefined;
|
|
519
|
+
/**
|
|
520
|
+
* True to require private key verification for client sessions. For server
|
|
521
|
+
* sessions, this option is specified per-identity in the
|
|
522
|
+
* `sessionOptions.sni` map.
|
|
523
|
+
* @since v23.8.0
|
|
524
|
+
*/
|
|
525
|
+
verifyPrivateKey?: boolean | undefined;
|
|
526
|
+
/**
|
|
527
|
+
* The QUIC version number to use. This is an advanced option that users typically
|
|
528
|
+
* won't have need to specify.
|
|
529
|
+
* @since v23.8.0
|
|
530
|
+
*/
|
|
531
|
+
version?: number | undefined;
|
|
532
|
+
// Undocumented
|
|
533
|
+
onerror?: QuicSession["onerror"] | undefined;
|
|
534
|
+
onstream?: QuicSession["onstream"] | undefined;
|
|
535
|
+
ondatagram?: QuicSession["ondatagram"] | undefined;
|
|
536
|
+
ondatagramstatus?: QuicSession["ondatagramstatus"] | undefined;
|
|
537
|
+
onpathvalidation?: QuicSession["onpathvalidation"] | undefined;
|
|
538
|
+
onsessionticket?: QuicSession["onsessionticket"] | undefined;
|
|
539
|
+
onversionnegotiation?: QuicSession["onversionnegotiation"] | undefined;
|
|
540
|
+
onhandshake?: QuicSession["onhandshake"] | undefined;
|
|
541
|
+
onnewtoken?: QuicSession["onnewtoken"] | undefined;
|
|
542
|
+
onearlyrejected?: QuicSession["onearlyrejected"] | undefined;
|
|
543
|
+
onorigin?: QuicSession["onorigin"] | undefined;
|
|
544
|
+
ongoaway?: QuicSession["ongoaway"] | undefined;
|
|
545
|
+
onkeylog?: QuicSession["onkeylog"] | undefined;
|
|
546
|
+
onqlog?: QuicSession["onqlog"] | undefined;
|
|
547
|
+
onapplication?: QuicSession["onapplication"] | undefined;
|
|
548
|
+
onheaders?: QuicStream["onheaders"] | undefined;
|
|
549
|
+
ontrailers?: QuicStream["ontrailers"] | undefined;
|
|
550
|
+
oninfo?: QuicStream["oninfo"] | undefined;
|
|
551
|
+
onwanttrailers?: QuicStream["onwanttrailers"] | undefined;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Initiate a new client-side session.
|
|
555
|
+
*
|
|
556
|
+
* ```js
|
|
557
|
+
* import { connect } from 'node:quic';
|
|
558
|
+
* import { Buffer } from 'node:buffer';
|
|
559
|
+
*
|
|
560
|
+
* const enc = new TextEncoder();
|
|
561
|
+
* const alpn = 'foo';
|
|
562
|
+
* const client = await connect('123.123.123.123:8888', { alpn });
|
|
563
|
+
* await client.createUnidirectionalStream({
|
|
564
|
+
* body: enc.encode('hello world'),
|
|
565
|
+
* });
|
|
566
|
+
* ```
|
|
567
|
+
*
|
|
568
|
+
* By default, every call to `connect(...)` will create a new local
|
|
569
|
+
* `QuicEndpoint` instance bound to a new random local IP port. To
|
|
570
|
+
* specify the exact local address to use, or to multiplex multiple
|
|
571
|
+
* QUIC sessions over a single local port, pass the `endpoint` option
|
|
572
|
+
* with either a `QuicEndpoint` or `EndpointOptions` as the argument.
|
|
573
|
+
*
|
|
574
|
+
* ```js
|
|
575
|
+
* import { QuicEndpoint, connect } from 'node:quic';
|
|
576
|
+
*
|
|
577
|
+
* const endpoint = new QuicEndpoint({
|
|
578
|
+
* address: '127.0.0.1:1234',
|
|
579
|
+
* });
|
|
580
|
+
*
|
|
581
|
+
* const client = await connect('123.123.123.123:8888', { endpoint });
|
|
582
|
+
* ```
|
|
583
|
+
* @since v23.8.0
|
|
584
|
+
*/
|
|
585
|
+
function connect(address: string | SocketAddress, options?: SessionOptions): Promise<QuicSession>;
|
|
586
|
+
/**
|
|
587
|
+
* Configures the endpoint to listen as a server. When a new session is initiated by
|
|
588
|
+
* a remote peer, the given `onsession` callback will be invoked with the created
|
|
589
|
+
* session.
|
|
590
|
+
*
|
|
591
|
+
* ```js
|
|
592
|
+
* import { listen } from 'node:quic';
|
|
593
|
+
*
|
|
594
|
+
* const endpoint = await listen((session) => {
|
|
595
|
+
* // ... handle the session
|
|
596
|
+
* });
|
|
597
|
+
*
|
|
598
|
+
* // Closing the endpoint allows any sessions open when close is called
|
|
599
|
+
* // to complete naturally while preventing new sessions from being
|
|
600
|
+
* // initiated. Once all existing sessions have finished, the endpoint
|
|
601
|
+
* // will be destroyed. The call returns a promise that is resolved once
|
|
602
|
+
* // the endpoint is destroyed.
|
|
603
|
+
* await endpoint.close();
|
|
604
|
+
* ```
|
|
605
|
+
*
|
|
606
|
+
* By default, every call to `listen(...)` will create a new local
|
|
607
|
+
* `QuicEndpoint` instance bound to a new random local IP port. To
|
|
608
|
+
* specify the exact local address to use, or to multiplex multiple
|
|
609
|
+
* QUIC sessions over a single local port, pass the `endpoint` option
|
|
610
|
+
* with either a `QuicEndpoint` or `EndpointOptions` as the argument.
|
|
611
|
+
*
|
|
612
|
+
* At most, any single `QuicEndpoint` can only be configured to listen as
|
|
613
|
+
* a server once.
|
|
614
|
+
* @since v23.8.0
|
|
615
|
+
*/
|
|
616
|
+
function listen(onsession: OnSessionCallback, options?: SessionOptions): Promise<QuicEndpoint>;
|
|
617
|
+
interface ListEndpointsOptions {
|
|
618
|
+
/**
|
|
619
|
+
* If `true` (the default), only returns endpoints that are
|
|
620
|
+
* active (not destroyed, not closing, and not busy). If `false` returns all
|
|
621
|
+
* endpoints.
|
|
622
|
+
*/
|
|
623
|
+
active?: boolean | undefined;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Returns the list of all `QuicEndpoint` instances. By default, only active
|
|
627
|
+
* endpoints are returned.
|
|
628
|
+
* @since v26.4.0
|
|
629
|
+
*/
|
|
630
|
+
function listEndpoints(options?: ListEndpointsOptions): QuicEndpoint[];
|
|
631
|
+
/**
|
|
632
|
+
* The endpoint configuration options passed when constructing a new `QuicEndpoint` instance.
|
|
633
|
+
* @since v23.8.0
|
|
634
|
+
*/
|
|
635
|
+
interface EndpointOptions {
|
|
636
|
+
/**
|
|
637
|
+
* If not specified the endpoint will bind to IPv4 `localhost` on a random port.
|
|
638
|
+
* @since v23.8.0
|
|
639
|
+
*/
|
|
640
|
+
address?: SocketAddress | string | undefined;
|
|
641
|
+
/**
|
|
642
|
+
* An optional `net.BlockList` instance for filtering incoming packets by
|
|
643
|
+
* source address. When configured, every received UDP packet is checked against
|
|
644
|
+
* the block list before any QUIC processing occurs, minimizing resource
|
|
645
|
+
* expenditure on blocked sources. The block list is evaluated live — rules
|
|
646
|
+
* added to the `BlockList` object after the endpoint is created take effect
|
|
647
|
+
* immediately.
|
|
648
|
+
*
|
|
649
|
+
* See `endpointOptions.blockListPolicy` for how matches are interpreted.
|
|
650
|
+
* @since v26.3.0
|
|
651
|
+
*/
|
|
652
|
+
blockList?: BlockList | undefined;
|
|
653
|
+
/**
|
|
654
|
+
* Controls how the `endpointOptions.blockList` is interpreted:
|
|
655
|
+
*
|
|
656
|
+
* * `'deny'` — Packets from addresses matching the block list are dropped.
|
|
657
|
+
* All other addresses are accepted. This is the typical blocklist mode.
|
|
658
|
+
* * `'allow'` — Only packets from addresses matching the block list are
|
|
659
|
+
* accepted. All other addresses are dropped. This is an allowlist mode
|
|
660
|
+
* for restricting access to known clients.
|
|
661
|
+
*
|
|
662
|
+
* If no block list is configured, this option has no effect.
|
|
663
|
+
* @since v26.3.0
|
|
664
|
+
*/
|
|
665
|
+
blockListPolicy?: "deny" | "allow" | undefined;
|
|
666
|
+
/**
|
|
667
|
+
* The endpoint maintains an internal cache of validated socket addresses as a
|
|
668
|
+
* performance optimization. This option sets the maximum number of addresses
|
|
669
|
+
* that are cached. This is an advanced option that users typically won't have
|
|
670
|
+
* need to specify.
|
|
671
|
+
* @since v23.8.0
|
|
672
|
+
*/
|
|
673
|
+
addressLRUSize?: bigint | number | undefined;
|
|
674
|
+
/**
|
|
675
|
+
* When `true`, the endpoint will not send stateless reset packets in response
|
|
676
|
+
* to packets from unknown connections. Stateless resets allow a peer to detect
|
|
677
|
+
* that a connection has been lost even when the server has no state for it.
|
|
678
|
+
* Disabling them may be useful in testing or when stateless resets are handled
|
|
679
|
+
* at a different layer.
|
|
680
|
+
* @since v26.2.0
|
|
681
|
+
*/
|
|
682
|
+
disableStatelessReset?: boolean | undefined;
|
|
683
|
+
/**
|
|
684
|
+
* The number of seconds an endpoint will remain alive after all sessions have
|
|
685
|
+
* closed and it is no longer listening. A value of `0` (default) means the
|
|
686
|
+
* endpoint is only destroyed when explicitly closed via `endpoint.close()` or
|
|
687
|
+
* `endpoint.destroy()`. A positive value starts an idle timer when the endpoint
|
|
688
|
+
* becomes idle; if no new sessions are created before the timer fires, the
|
|
689
|
+
* endpoint is automatically destroyed. This is useful for connection pooling
|
|
690
|
+
* where endpoints should linger briefly for reuse by future `connect()` calls.
|
|
691
|
+
* @since v26.2.0
|
|
692
|
+
*/
|
|
693
|
+
idleTimeout?: number | undefined;
|
|
694
|
+
/**
|
|
695
|
+
* When `true`, indicates that the endpoint should bind only to IPv6 addresses.
|
|
696
|
+
* @since v23.8.0
|
|
697
|
+
*/
|
|
698
|
+
ipv6Only?: boolean | undefined;
|
|
699
|
+
/**
|
|
700
|
+
* Specifies the maximum number of concurrent sessions allowed per remote IP
|
|
701
|
+
* address (ignoring port). When the limit is reached, new connections from the
|
|
702
|
+
* same IP are refused with `CONNECTION_REFUSED`. A value of `0` disables the
|
|
703
|
+
* limit. The maximum value is `65535`.
|
|
704
|
+
*
|
|
705
|
+
* This limit can also be changed dynamically after construction via
|
|
706
|
+
* `endpoint.maxConnectionsPerHost`.
|
|
707
|
+
* @since v23.8.0
|
|
708
|
+
*/
|
|
709
|
+
maxConnectionsPerHost?: number | undefined;
|
|
710
|
+
/**
|
|
711
|
+
* Specifies the maximum total number of concurrent sessions across all remote
|
|
712
|
+
* addresses. When the limit is reached, new connections are refused with
|
|
713
|
+
* `CONNECTION_REFUSED`. A value of `0` disables the limit. The maximum value is
|
|
714
|
+
* `65535`.
|
|
715
|
+
*
|
|
716
|
+
* This limit can also be changed dynamically after construction via
|
|
717
|
+
* `endpoint.maxConnectionsTotal`.
|
|
718
|
+
* @since v23.8.0
|
|
719
|
+
*/
|
|
720
|
+
maxConnectionsTotal?: number | undefined;
|
|
721
|
+
/**
|
|
722
|
+
* The maximum number of QUIC retry packets the endpoint will send per second.
|
|
723
|
+
* This is a global rate limit (not per-host) that caps the total server-wide
|
|
724
|
+
* retry response rate, preventing spoofed-source floods from consuming unbounded
|
|
725
|
+
* resources.
|
|
726
|
+
* @since v26.3.0
|
|
727
|
+
*/
|
|
728
|
+
retryRate?: number | undefined;
|
|
729
|
+
/**
|
|
730
|
+
* The maximum burst of retry packets allowed before rate limiting takes effect.
|
|
731
|
+
* @since v26.3.0
|
|
732
|
+
*/
|
|
733
|
+
retryBurst?: number | undefined;
|
|
734
|
+
/**
|
|
735
|
+
* The maximum number of stateless reset packets the endpoint will send per second.
|
|
736
|
+
* @since v26.3.0
|
|
737
|
+
*/
|
|
738
|
+
statelessResetRate?: number | undefined;
|
|
739
|
+
/**
|
|
740
|
+
* The maximum burst of stateless reset packets allowed before rate limiting
|
|
741
|
+
* takes effect.
|
|
742
|
+
* @since v26.3.0
|
|
743
|
+
*/
|
|
744
|
+
statelessResetBurst?: number | undefined;
|
|
745
|
+
/**
|
|
746
|
+
* The maximum number of version negotiation packets the endpoint will send per
|
|
747
|
+
* second.
|
|
748
|
+
* @since v26.3.0
|
|
749
|
+
*/
|
|
750
|
+
versionNegotiationRate?: number | undefined;
|
|
751
|
+
/**
|
|
752
|
+
* The maximum number of immediate connection close packets the endpoint will
|
|
753
|
+
* send per second.
|
|
754
|
+
* @since v26.3.0
|
|
755
|
+
*/
|
|
756
|
+
versionNegotiationBurst?: number | undefined;
|
|
757
|
+
/**
|
|
758
|
+
* The maximum number of immediate connection close packets the endpoint will
|
|
759
|
+
* send per second.
|
|
760
|
+
* @since v26.3.0
|
|
761
|
+
*/
|
|
762
|
+
immediateCloseRate?: number | undefined;
|
|
763
|
+
/**
|
|
764
|
+
* The maximum burst of immediate connection close packets allowed before rate
|
|
765
|
+
* limiting takes effect.
|
|
766
|
+
* @since v26.3.0
|
|
767
|
+
*/
|
|
768
|
+
immediateCloseBurst?: number | undefined;
|
|
769
|
+
/**
|
|
770
|
+
* The maximum number of new sessions that a single remote address can create per
|
|
771
|
+
* second. This is a per-host rate limit tracked in the address validation LRU
|
|
772
|
+
* cache. It prevents a validated remote address from churning through sessions
|
|
773
|
+
* (rapidly opening and abandoning connections) faster than the server can handle.
|
|
774
|
+
* For benchmarking where traffic comes from a single source, set this to a high
|
|
775
|
+
* value.
|
|
776
|
+
* @since v26.3.0
|
|
777
|
+
*/
|
|
778
|
+
sessionCreationRate?: number | undefined;
|
|
779
|
+
/**
|
|
780
|
+
* The maximum burst of new session creations allowed from a single remote address
|
|
781
|
+
* before rate limiting takes effect.
|
|
782
|
+
* @since v26.3.0
|
|
783
|
+
*/
|
|
784
|
+
sessionCreationBurst?: number | undefined;
|
|
785
|
+
/**
|
|
786
|
+
* Specifies the length of time a QUIC retry token is considered valid.
|
|
787
|
+
* @since v23.8.0
|
|
788
|
+
*/
|
|
789
|
+
retryTokenExpiration?: bigint | number | undefined;
|
|
790
|
+
/**
|
|
791
|
+
* Specifies the 16-byte secret used to generate QUIC retry tokens.
|
|
792
|
+
* @since v23.8.0
|
|
793
|
+
*/
|
|
794
|
+
resetTokenSecret?: NodeJS.ArrayBufferView | undefined;
|
|
795
|
+
/**
|
|
796
|
+
* Specifies the length of time a QUIC token is considered valid.
|
|
797
|
+
* @since v23.8.0
|
|
798
|
+
*/
|
|
799
|
+
tokenExpiration?: bigint | number | undefined;
|
|
800
|
+
/**
|
|
801
|
+
* Specifies the 16-byte secret used to generate QUIC tokens.
|
|
802
|
+
* @since v23.8.0
|
|
803
|
+
*/
|
|
804
|
+
tokenSecret?: NodeJS.ArrayBufferView | undefined;
|
|
805
|
+
/**
|
|
806
|
+
* @since v23.8.0
|
|
807
|
+
*/
|
|
808
|
+
udpReceiveBufferSize?: number | undefined;
|
|
809
|
+
/**
|
|
810
|
+
* @since v23.8.0
|
|
811
|
+
*/
|
|
812
|
+
udpSendBufferSize?: number | undefined;
|
|
813
|
+
/**
|
|
814
|
+
* @since v23.8.0
|
|
815
|
+
*/
|
|
816
|
+
udpTTL?: number | undefined;
|
|
817
|
+
/**
|
|
818
|
+
* When `true`, requires that the endpoint validate peer addresses using retry packets
|
|
819
|
+
* while establishing a new connection.
|
|
820
|
+
* @since v23.8.0
|
|
821
|
+
*/
|
|
822
|
+
validateAddress?: boolean | undefined;
|
|
823
|
+
}
|
|
824
|
+
interface SetSNIContextsOptions {
|
|
825
|
+
replace?: boolean | undefined;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* A `QuicEndpoint` encapsulates the local UDP-port binding for QUIC. It can be
|
|
829
|
+
* used as both a client and a server.
|
|
830
|
+
* @since v23.8.0
|
|
831
|
+
*/
|
|
832
|
+
class QuicEndpoint implements AsyncDisposable {
|
|
833
|
+
constructor(options?: EndpointOptions);
|
|
834
|
+
/**
|
|
835
|
+
* The local UDP socket address to which the endpoint is bound, if any.
|
|
836
|
+
*
|
|
837
|
+
* If the endpoint is not currently bound then the value will be `undefined`. Read only.
|
|
838
|
+
* @since v23.8.0
|
|
839
|
+
*/
|
|
840
|
+
readonly address: SocketAddress | undefined;
|
|
841
|
+
/**
|
|
842
|
+
* When `endpoint.busy` is set to true, the endpoint will temporarily reject
|
|
843
|
+
* new sessions from being created. Read/write.
|
|
844
|
+
*
|
|
845
|
+
* ```js
|
|
846
|
+
* // Mark the endpoint busy. New sessions will be prevented.
|
|
847
|
+
* endpoint.busy = true;
|
|
848
|
+
*
|
|
849
|
+
* // Mark the endpoint free. New session will be allowed.
|
|
850
|
+
* endpoint.busy = false;
|
|
851
|
+
* ```
|
|
852
|
+
*
|
|
853
|
+
* The `busy` property is useful when the endpoint is under heavy load and needs to
|
|
854
|
+
* temporarily reject new sessions while it catches up.
|
|
855
|
+
* @since v23.8.0
|
|
856
|
+
*/
|
|
857
|
+
busy: boolean;
|
|
858
|
+
/**
|
|
859
|
+
* Gracefully close the endpoint. The endpoint will close and destroy itself when
|
|
860
|
+
* all currently open sessions close. Once called, new sessions will be rejected.
|
|
861
|
+
*
|
|
862
|
+
* Returns a promise that is fulfilled when the endpoint is destroyed.
|
|
863
|
+
* @since v23.8.0
|
|
864
|
+
*/
|
|
865
|
+
close(): Promise<void>;
|
|
866
|
+
/**
|
|
867
|
+
* A promise that is fulfilled when the endpoint is destroyed. This will be the same promise that is
|
|
868
|
+
* returned by the `endpoint.close()` function. Read only.
|
|
869
|
+
* @since v23.8.0
|
|
870
|
+
*/
|
|
871
|
+
readonly closed: Promise<void>;
|
|
872
|
+
/**
|
|
873
|
+
* True if `endpoint.close()` has been called and closing the endpoint has not yet completed.
|
|
874
|
+
* Read only.
|
|
875
|
+
* @since v23.8.0
|
|
876
|
+
*/
|
|
877
|
+
readonly closing: boolean;
|
|
878
|
+
/**
|
|
879
|
+
* Forcefully closes the endpoint by forcing all open sessions to be immediately
|
|
880
|
+
* closed.
|
|
881
|
+
* @since v23.8.0
|
|
882
|
+
*/
|
|
883
|
+
destroy(error?: any): void;
|
|
884
|
+
/**
|
|
885
|
+
* True if `endpoint.destroy()` has been called. Read only.
|
|
886
|
+
* @since v23.8.0
|
|
887
|
+
*/
|
|
888
|
+
readonly destroyed: boolean;
|
|
889
|
+
/**
|
|
890
|
+
* True if the endpoint is actively listening for incoming connections. Read only.
|
|
891
|
+
* @since v26.2.0
|
|
892
|
+
*/
|
|
893
|
+
readonly listening: boolean;
|
|
894
|
+
/**
|
|
895
|
+
* The maximum number of concurrent connections allowed per remote IP address.
|
|
896
|
+
* `0` means unlimited (default). Can be set at construction time via the
|
|
897
|
+
* `maxConnectionsPerHost` option and changed dynamically at any time.
|
|
898
|
+
* The valid range is `0` to `65535`.
|
|
899
|
+
* @since v26.2.0
|
|
900
|
+
*/
|
|
901
|
+
maxConnectionsPerHost: number;
|
|
902
|
+
/**
|
|
903
|
+
* The maximum total number of concurrent connections across all remote
|
|
904
|
+
* addresses. `0` means unlimited (default). Can be set at construction time via
|
|
905
|
+
* the `maxConnectionsTotal` option and changed dynamically at any time.
|
|
906
|
+
* The valid range is `0` to `65535`.
|
|
907
|
+
* @since v26.2.0
|
|
908
|
+
*/
|
|
909
|
+
maxConnectionsTotal: number;
|
|
910
|
+
/**
|
|
911
|
+
* Replaces or updates the SNI TLS contexts for this endpoint. This allows
|
|
912
|
+
* changing the TLS identity (key/certificate) used for specific host names
|
|
913
|
+
* without restarting the endpoint. Existing sessions are unaffected — only
|
|
914
|
+
* new sessions will use the updated contexts.
|
|
915
|
+
*
|
|
916
|
+
* ```js
|
|
917
|
+
* endpoint.setSNIContexts({
|
|
918
|
+
* 'api.example.com': { keys: [newApiKey], certs: [newApiCert] },
|
|
919
|
+
* });
|
|
920
|
+
*
|
|
921
|
+
* // Replace the entire SNI map
|
|
922
|
+
* endpoint.setSNIContexts({
|
|
923
|
+
* 'api.example.com': { keys: [newApiKey], certs: [newApiCert] },
|
|
924
|
+
* }, { replace: true });
|
|
925
|
+
* ```
|
|
926
|
+
* @since v26.1.0
|
|
927
|
+
* @param entries An object mapping host names to TLS identity options.
|
|
928
|
+
* Each entry must include `keys` and `certs`.
|
|
929
|
+
*/
|
|
930
|
+
setSNIContexts(entries: Record<string, SNIEntry>, options?: SetSNIContextsOptions): void;
|
|
931
|
+
/**
|
|
932
|
+
* The statistics collected for an active endpoint. Read only.
|
|
933
|
+
* @since v23.8.0
|
|
934
|
+
*/
|
|
935
|
+
readonly stats: QuicEndpoint.Stats;
|
|
936
|
+
/**
|
|
937
|
+
* Calls `endpoint.close()` and returns a promise that fulfills when the
|
|
938
|
+
* endpoint has closed.
|
|
939
|
+
* @since v23.8.0
|
|
940
|
+
*/
|
|
941
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
942
|
+
}
|
|
943
|
+
namespace QuicEndpoint {
|
|
944
|
+
/**
|
|
945
|
+
* A view of the collected statistics for an endpoint.
|
|
946
|
+
* @since v23.8.0
|
|
947
|
+
*/
|
|
948
|
+
class Stats {
|
|
949
|
+
private constructor();
|
|
950
|
+
/**
|
|
951
|
+
* A timestamp indicating the moment the endpoint was created. Read only.
|
|
952
|
+
* @since v23.8.0
|
|
953
|
+
*/
|
|
954
|
+
readonly createdAt: bigint;
|
|
955
|
+
/**
|
|
956
|
+
* A timestamp indicating the moment the endpoint was destroyed. Read only.
|
|
957
|
+
* @since v23.8.0
|
|
958
|
+
*/
|
|
959
|
+
readonly destroyedAt: bigint;
|
|
960
|
+
/**
|
|
961
|
+
* The total number of bytes received by this endpoint. Read only.
|
|
962
|
+
* @since v23.8.0
|
|
963
|
+
*/
|
|
964
|
+
readonly bytesReceived: bigint;
|
|
965
|
+
/**
|
|
966
|
+
* The total number of bytes sent by this endpoint. Read only.
|
|
967
|
+
* @since v23.8.0
|
|
968
|
+
*/
|
|
969
|
+
readonly bytesSent: bigint;
|
|
970
|
+
/**
|
|
971
|
+
* The total number of QUIC packets successfully received by this endpoint. Read only.
|
|
972
|
+
* @since v23.8.0
|
|
973
|
+
*/
|
|
974
|
+
readonly packetsReceived: bigint;
|
|
975
|
+
/**
|
|
976
|
+
* The total number of QUIC packets successfully sent by this endpoint. Read only.
|
|
977
|
+
* @since v23.8.0
|
|
978
|
+
*/
|
|
979
|
+
readonly packetsSent: bigint;
|
|
980
|
+
/**
|
|
981
|
+
* The total number of peer-initiated sessions received by this endpoint. Read only.
|
|
982
|
+
* @since v23.8.0
|
|
983
|
+
*/
|
|
984
|
+
readonly serverSessions: bigint;
|
|
985
|
+
/**
|
|
986
|
+
* The total number of sessions initiated by this endpoint. Read only.
|
|
987
|
+
* @since v23.8.0
|
|
988
|
+
*/
|
|
989
|
+
readonly clientSessions: bigint;
|
|
990
|
+
/**
|
|
991
|
+
* The total number of times an initial packet was rejected due to the
|
|
992
|
+
* endpoint being marked busy. Read only.
|
|
993
|
+
* @since v23.8.0
|
|
994
|
+
*/
|
|
995
|
+
readonly serverBusyCount: bigint;
|
|
996
|
+
/**
|
|
997
|
+
* The total number of retry packets sent by this endpoint. Read only.
|
|
998
|
+
* @since v23.8.0
|
|
999
|
+
*/
|
|
1000
|
+
readonly retryCount: bigint;
|
|
1001
|
+
/**
|
|
1002
|
+
* The total number of retry packets dropped by the global rate
|
|
1003
|
+
* limiter. Read only. A non-zero value indicates the endpoint is under retry
|
|
1004
|
+
* flood pressure.
|
|
1005
|
+
* @since v26.3.0
|
|
1006
|
+
*/
|
|
1007
|
+
readonly retryRateLimited: bigint;
|
|
1008
|
+
/**
|
|
1009
|
+
* The total number of version negotiation packets sent by this
|
|
1010
|
+
* endpoint. Read only.
|
|
1011
|
+
* @since v23.8.0
|
|
1012
|
+
*/
|
|
1013
|
+
readonly versionNegotiationCount: bigint;
|
|
1014
|
+
/**
|
|
1015
|
+
* The total number of version negotiation packets dropped by
|
|
1016
|
+
* the global rate limiter. Read only.
|
|
1017
|
+
* @since v26.3.0
|
|
1018
|
+
*/
|
|
1019
|
+
readonly versionNegotiationRateLimited: bigint;
|
|
1020
|
+
/**
|
|
1021
|
+
* The total number of stateless reset packets sent by this
|
|
1022
|
+
* endpoint. Read only.
|
|
1023
|
+
* @since v23.8.0
|
|
1024
|
+
*/
|
|
1025
|
+
readonly statelessResetCount: bigint;
|
|
1026
|
+
/**
|
|
1027
|
+
* The total number of stateless reset packets dropped by the
|
|
1028
|
+
* global rate limiter. Read only.
|
|
1029
|
+
* @since v26.3.0
|
|
1030
|
+
*/
|
|
1031
|
+
readonly statelessResetRateLimited: bigint;
|
|
1032
|
+
/**
|
|
1033
|
+
* The total number of immediate connection close packets sent
|
|
1034
|
+
* by this endpoint. Read only.
|
|
1035
|
+
* @since v23.8.0
|
|
1036
|
+
*/
|
|
1037
|
+
readonly immediateCloseCount: bigint;
|
|
1038
|
+
/**
|
|
1039
|
+
* The total number of immediate connection close packets
|
|
1040
|
+
* dropped by the global rate limiter. Read only.
|
|
1041
|
+
* @since v26.3.0
|
|
1042
|
+
*/
|
|
1043
|
+
readonly immediateCloseRateLimited: bigint;
|
|
1044
|
+
/**
|
|
1045
|
+
* The total number of session creation attempts dropped by the
|
|
1046
|
+
* per-host rate limiter. Read only. A non-zero value indicates one or more
|
|
1047
|
+
* remote addresses are creating sessions faster than the configured rate allows.
|
|
1048
|
+
* @since v26.3.0
|
|
1049
|
+
*/
|
|
1050
|
+
readonly sessionCreationRateLimited: bigint;
|
|
1051
|
+
/**
|
|
1052
|
+
* The total number of incoming packets dropped by the
|
|
1053
|
+
* block list filter. Read only.
|
|
1054
|
+
* @since v26.3.0
|
|
1055
|
+
*/
|
|
1056
|
+
readonly packetsBlocked: bigint;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
interface CreateStreamOptions {
|
|
1060
|
+
/**
|
|
1061
|
+
* The outbound body source. See `stream.setBody()` for details on
|
|
1062
|
+
* supported types. When omitted, the stream's outgoing side remains
|
|
1063
|
+
* writable with no body queued; no FIN is sent immediately.
|
|
1064
|
+
*/
|
|
1065
|
+
body?: StreamBody | undefined;
|
|
1066
|
+
/**
|
|
1067
|
+
* Initial request or response headers to send. Only
|
|
1068
|
+
* used when the session supports headers (e.g. HTTP/3). If `body` is not
|
|
1069
|
+
* specified and `headers` is provided, the stream is treated as
|
|
1070
|
+
* headers-only (terminal).
|
|
1071
|
+
*/
|
|
1072
|
+
headers?: NodeJS.Dict<string | readonly string[]> | readonly string[] | undefined;
|
|
1073
|
+
/**
|
|
1074
|
+
* The priority level of the stream. One of `'high'`,
|
|
1075
|
+
* `'default'`, or `'low'`. **Default:** `'default'`.
|
|
1076
|
+
*/
|
|
1077
|
+
priority?: "high" | "default" | "low" | undefined;
|
|
1078
|
+
/**
|
|
1079
|
+
* When `true`, data from this stream may be
|
|
1080
|
+
* interleaved with data from other streams of the same priority level.
|
|
1081
|
+
* When `false`, the stream should be completed before same-priority peers.
|
|
1082
|
+
* **Default:** `false`.
|
|
1083
|
+
*/
|
|
1084
|
+
incremental?: boolean | undefined;
|
|
1085
|
+
/**
|
|
1086
|
+
* The maximum number of bytes that the writer
|
|
1087
|
+
* will buffer before `writeSync()` returns `false`. When the buffered
|
|
1088
|
+
* data exceeds this limit, the caller should wait for drain before
|
|
1089
|
+
* writing more. **Default:** `65536` (64 KB).
|
|
1090
|
+
*/
|
|
1091
|
+
highWaterMark?: number | undefined;
|
|
1092
|
+
/**
|
|
1093
|
+
* Callback for received initial response headers.
|
|
1094
|
+
* Called with `(headers)`.
|
|
1095
|
+
*/
|
|
1096
|
+
onheaders?: QuicStream["onheaders"] | undefined;
|
|
1097
|
+
/**
|
|
1098
|
+
* Callback for received trailing headers.
|
|
1099
|
+
* Called with `(trailers)`.
|
|
1100
|
+
*/
|
|
1101
|
+
ontrailers?: QuicStream["ontrailers"] | undefined;
|
|
1102
|
+
/**
|
|
1103
|
+
* Callback for received informational (1xx) headers.
|
|
1104
|
+
* Called with `(headers)`.
|
|
1105
|
+
*/
|
|
1106
|
+
oninfo?: QuicStream["oninfo"] | undefined;
|
|
1107
|
+
/**
|
|
1108
|
+
* Callback when trailers should be sent.
|
|
1109
|
+
*/
|
|
1110
|
+
onwanttrailers?: QuicStream["onwanttrailers"] | undefined;
|
|
1111
|
+
}
|
|
1112
|
+
interface SessionDestroyOptions {
|
|
1113
|
+
/**
|
|
1114
|
+
* The error code to include in the `CONNECTION_CLOSE`
|
|
1115
|
+
* frame sent to the peer. **Default:** `0` (no error).
|
|
1116
|
+
*/
|
|
1117
|
+
code?: bigint | number | undefined;
|
|
1118
|
+
/**
|
|
1119
|
+
* Either `'transport'` or `'application'`. Determines the
|
|
1120
|
+
* error code namespace used in the `CONNECTION_CLOSE` frame. When `'transport'`
|
|
1121
|
+
* (the default), the frame type is `0x1c` and the code is interpreted as a QUIC
|
|
1122
|
+
* transport error. When `'application'`, the frame type is `0x1d` and the code
|
|
1123
|
+
* is application-specific. **Default:** `'transport'`.
|
|
1124
|
+
*/
|
|
1125
|
+
type?: "transport" | "application" | undefined;
|
|
1126
|
+
/**
|
|
1127
|
+
* An optional human-readable reason string included in
|
|
1128
|
+
* the `CONNECTION_CLOSE` frame. Per RFC 9000, this is for diagnostic purposes
|
|
1129
|
+
* only and should not be used for machine-readable error descriptions.
|
|
1130
|
+
*/
|
|
1131
|
+
reason?: string | undefined;
|
|
1132
|
+
}
|
|
1133
|
+
interface SessionHandshakeInfo {
|
|
1134
|
+
/**
|
|
1135
|
+
* The local socket address.
|
|
1136
|
+
*/
|
|
1137
|
+
local: SocketAddress;
|
|
1138
|
+
/**
|
|
1139
|
+
* The remote socket address.
|
|
1140
|
+
*/
|
|
1141
|
+
remote: SocketAddress;
|
|
1142
|
+
/**
|
|
1143
|
+
* The SNI server name negotiated during the handshake.
|
|
1144
|
+
*/
|
|
1145
|
+
servername: string;
|
|
1146
|
+
/**
|
|
1147
|
+
* The ALPN protocol negotiated during the handshake.
|
|
1148
|
+
*/
|
|
1149
|
+
protocol: string;
|
|
1150
|
+
/**
|
|
1151
|
+
* The name of the negotiated TLS cipher suite.
|
|
1152
|
+
*/
|
|
1153
|
+
cipher: string;
|
|
1154
|
+
/**
|
|
1155
|
+
* The TLS protocol version of the cipher suite
|
|
1156
|
+
* (e.g., `'TLSv1.3'`).
|
|
1157
|
+
*/
|
|
1158
|
+
cipherVersion: string;
|
|
1159
|
+
/**
|
|
1160
|
+
* If certificate validation failed, the
|
|
1161
|
+
* reason string. Empty string if validation succeeded.
|
|
1162
|
+
*/
|
|
1163
|
+
validationErrorReason: string;
|
|
1164
|
+
/**
|
|
1165
|
+
* If certificate validation failed, the
|
|
1166
|
+
* error code. `0` if validation succeeded.
|
|
1167
|
+
*/
|
|
1168
|
+
validationErrorCode: number;
|
|
1169
|
+
/**
|
|
1170
|
+
* Whether 0-RTT early data was attempted.
|
|
1171
|
+
*/
|
|
1172
|
+
earlyDataAttempted: boolean;
|
|
1173
|
+
/**
|
|
1174
|
+
* Whether 0-RTT early data was accepted by
|
|
1175
|
+
* the server.
|
|
1176
|
+
*/
|
|
1177
|
+
earlyDataAccepted: boolean;
|
|
1178
|
+
}
|
|
1179
|
+
interface SessionPath {
|
|
1180
|
+
local: SocketAddress;
|
|
1181
|
+
remote: SocketAddress;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* A `QuicSession` represents the local side of a QUIC connection.
|
|
1185
|
+
* @since v23.8.0
|
|
1186
|
+
*/
|
|
1187
|
+
class QuicSession implements AsyncDisposable {
|
|
1188
|
+
private constructor();
|
|
1189
|
+
/**
|
|
1190
|
+
* The current application-level options for this session. These include settings
|
|
1191
|
+
* that are specific to the negotiated application protocol (e.g. HTTP/3) and may
|
|
1192
|
+
* be negotiated separately from the transport parameters. Read only.
|
|
1193
|
+
* @since v26.3.0
|
|
1194
|
+
*/
|
|
1195
|
+
readonly applicationOptions: SessionApplicationOptions;
|
|
1196
|
+
/**
|
|
1197
|
+
* Initiate a graceful close of the session. Existing streams will be allowed
|
|
1198
|
+
* to complete but no new streams will be opened. Once all streams have closed,
|
|
1199
|
+
* the session will be destroyed. The returned promise will be fulfilled once
|
|
1200
|
+
* the session has been destroyed. If a non-zero `code` is specified, the
|
|
1201
|
+
* promise will reject with an `ERR_QUIC_TRANSPORT_ERROR` or
|
|
1202
|
+
* `ERR_QUIC_APPLICATION_ERROR` depending on the `type`.
|
|
1203
|
+
* @since v23.8.0
|
|
1204
|
+
*/
|
|
1205
|
+
close(options?: SessionDestroyOptions): Promise<void>;
|
|
1206
|
+
/**
|
|
1207
|
+
* A promise that is fulfilled once the TLS handshake completes successfully.
|
|
1208
|
+
* The resolved value contains information about the established session
|
|
1209
|
+
* including the negotiated protocol, cipher suite, certificate validation
|
|
1210
|
+
* status, and 0-RTT early data status.
|
|
1211
|
+
*
|
|
1212
|
+
* If the handshake fails or the session is destroyed before the handshake
|
|
1213
|
+
* completes, the promise will be rejected.
|
|
1214
|
+
* @since v26.2.0
|
|
1215
|
+
*/
|
|
1216
|
+
readonly opened: Promise<SessionHandshakeInfo>;
|
|
1217
|
+
/**
|
|
1218
|
+
* A promise that is fulfilled once the session is destroyed.
|
|
1219
|
+
* @since v23.8.0
|
|
1220
|
+
*/
|
|
1221
|
+
readonly closed: Promise<void>;
|
|
1222
|
+
/**
|
|
1223
|
+
* True if `session.close()` has been called and the session has not yet
|
|
1224
|
+
* been destroyed. Read only.
|
|
1225
|
+
* @since v26.2.0
|
|
1226
|
+
*/
|
|
1227
|
+
readonly closing: boolean;
|
|
1228
|
+
/**
|
|
1229
|
+
* Immediately destroy the session. All streams will be destroyed and the
|
|
1230
|
+
* session will be closed. If `error` is provided and [`session.onerror`][] is
|
|
1231
|
+
* set, the `onerror` callback is invoked before destruction. The
|
|
1232
|
+
* `session.closed` promise will reject with the error. If `options` is
|
|
1233
|
+
* provided, the `CONNECTION_CLOSE` frame sent to the peer will include the
|
|
1234
|
+
* specified error code, type, and reason.
|
|
1235
|
+
* @since v23.8.0
|
|
1236
|
+
*/
|
|
1237
|
+
destroy(error?: any, options?: SessionDestroyOptions): void;
|
|
1238
|
+
/**
|
|
1239
|
+
* True if `session.destroy()` has been called. Read only.
|
|
1240
|
+
* @since v23.8.0
|
|
1241
|
+
*/
|
|
1242
|
+
readonly destroyed: boolean;
|
|
1243
|
+
/**
|
|
1244
|
+
* The endpoint that created this session. Returns `null` if the session
|
|
1245
|
+
* has been destroyed. Read only.
|
|
1246
|
+
* @since v23.8.0
|
|
1247
|
+
*/
|
|
1248
|
+
readonly endpoint: QuicEndpoint | null;
|
|
1249
|
+
/**
|
|
1250
|
+
* The callback to invoke when new application options, e.g. HTTP/3 settings arrived.
|
|
1251
|
+
* @since v26.4
|
|
1252
|
+
*/
|
|
1253
|
+
onapplication: OnApplicationCallback | undefined;
|
|
1254
|
+
/**
|
|
1255
|
+
* An optional callback invoked when the session is destroyed with an error.
|
|
1256
|
+
* This includes errors caused by user callbacks that throw or reject (see
|
|
1257
|
+
* [Callback error handling](https://nodejs.org/docs/latest-v26.x/api/quic.html#callback-error-handling)). The callback receives a single argument: the
|
|
1258
|
+
* error that triggered the destruction. If the `onerror` callback itself throws
|
|
1259
|
+
* or returns a promise that rejects, the error is surfaced as an uncaught
|
|
1260
|
+
* exception. Read/write.
|
|
1261
|
+
*
|
|
1262
|
+
* Can also be set via the `onerror` option in `quic.connect()` or
|
|
1263
|
+
* `quic.listen()`.
|
|
1264
|
+
* @since v26.2.0
|
|
1265
|
+
*/
|
|
1266
|
+
onerror: ((this: QuicSession, error: any) => void) | undefined;
|
|
1267
|
+
/**
|
|
1268
|
+
* The callback to invoke when a new stream is initiated by a remote peer. Read/write.
|
|
1269
|
+
* @since v23.8.0
|
|
1270
|
+
*/
|
|
1271
|
+
onstream: OnStreamCallback | undefined;
|
|
1272
|
+
/**
|
|
1273
|
+
* The callback to invoke when the server rejects 0-RTT early data. When
|
|
1274
|
+
* this fires, all streams that were opened during the 0-RTT phase have
|
|
1275
|
+
* been destroyed. The application should re-open streams if needed.
|
|
1276
|
+
* Read/write.
|
|
1277
|
+
*
|
|
1278
|
+
* This callback only fires on the client side when the server rejects
|
|
1279
|
+
* the client's 0-RTT attempt. The connection falls back to 1-RTT and
|
|
1280
|
+
* continues normally.
|
|
1281
|
+
* @since v26.2.0
|
|
1282
|
+
*/
|
|
1283
|
+
onearlyrejected: ((this: QuicSession) => void) | undefined;
|
|
1284
|
+
/**
|
|
1285
|
+
* The callback to invoke when a new datagram is received from a remote peer. Read/write.
|
|
1286
|
+
* @since v23.8.0
|
|
1287
|
+
*/
|
|
1288
|
+
ondatagram: OnDatagramCallback | undefined;
|
|
1289
|
+
/**
|
|
1290
|
+
* The callback to invoke when the status of a datagram is updated. Read/write.
|
|
1291
|
+
* @since v23.8.0
|
|
1292
|
+
*/
|
|
1293
|
+
ondatagramstatus: OnDatagramStatusCallback | undefined;
|
|
1294
|
+
/**
|
|
1295
|
+
* The callback to invoke when the path validation is updated. Read/write.
|
|
1296
|
+
* @since v23.8.0
|
|
1297
|
+
*/
|
|
1298
|
+
onpathvalidation: OnPathValidationCallback | undefined;
|
|
1299
|
+
/**
|
|
1300
|
+
* The callback to invoke when a new session ticket is received. Read/write.
|
|
1301
|
+
* @since v23.8.0
|
|
1302
|
+
*/
|
|
1303
|
+
onsessionticket: OnSessionTicketCallback | undefined;
|
|
1304
|
+
/**
|
|
1305
|
+
* The callback to invoke when a version negotiation is initiated. Read/write.
|
|
1306
|
+
* @since v23.8.0
|
|
1307
|
+
*/
|
|
1308
|
+
onversionnegotiation: OnVersionNegotiationCallback | undefined;
|
|
1309
|
+
/**
|
|
1310
|
+
* The callback to invoke when the TLS handshake is completed. Read/write.
|
|
1311
|
+
* @since v23.8.0
|
|
1312
|
+
*/
|
|
1313
|
+
onhandshake: OnHandshakeCallback | undefined;
|
|
1314
|
+
/**
|
|
1315
|
+
* The callback to invoke when a NEW\_TOKEN token is received from the server.
|
|
1316
|
+
* The token can be passed as the `token` option on a future connection to
|
|
1317
|
+
* the same server to skip address validation. Read/write.
|
|
1318
|
+
* @since v26.2.0
|
|
1319
|
+
*/
|
|
1320
|
+
onnewtoken: OnNewTokenCallback | undefined;
|
|
1321
|
+
/**
|
|
1322
|
+
* The callback to invoke when an ORIGIN frame (RFC 9412) is received from
|
|
1323
|
+
* the server, indicating which origins the server is authoritative for.
|
|
1324
|
+
* Read/write.
|
|
1325
|
+
* @since v26.2.0
|
|
1326
|
+
*/
|
|
1327
|
+
onorigin: OnOriginCallback | undefined;
|
|
1328
|
+
/**
|
|
1329
|
+
* The callback to invoke when the peer sends an HTTP/3 GOAWAY frame,
|
|
1330
|
+
* indicating it is initiating a graceful shutdown. The callback receives
|
|
1331
|
+
* `(lastStreamId)` where `lastStreamId` is a `{bigint}`:
|
|
1332
|
+
*
|
|
1333
|
+
* * When `lastStreamId` is `-1n`, the peer sent a shutdown notice (intent
|
|
1334
|
+
* to close) without specifying a stream boundary. All existing streams
|
|
1335
|
+
* may still be processed.
|
|
1336
|
+
* * When `lastStreamId` is `>= 0n`, it is the highest stream ID the peer
|
|
1337
|
+
* may have processed. Streams with IDs above this value were NOT
|
|
1338
|
+
* processed and can be safely retried on a new connection.
|
|
1339
|
+
*
|
|
1340
|
+
* After GOAWAY is received, `session.createBidirectionalStream()` will
|
|
1341
|
+
* throw `ERR_INVALID_STATE`. Existing streams continue until they
|
|
1342
|
+
* complete or the session closes.
|
|
1343
|
+
*
|
|
1344
|
+
* This callback is only relevant for HTTP/3 sessions. Read/write.
|
|
1345
|
+
* @since v26.2.0
|
|
1346
|
+
*/
|
|
1347
|
+
ongoaway: ((this: QuicSession, lastStreamId: bigint) => void) | undefined;
|
|
1348
|
+
/**
|
|
1349
|
+
* The callback to invoke when TLS key material is available. Requires
|
|
1350
|
+
* `sessionOptions.keylog` to be `true`. Each invocation receives a single
|
|
1351
|
+
* line of [NSS Key Log Format](https://udn.realityripple.com/docs/Mozilla/Projects/NSS/Key_Log_Format) text (including a trailing newline). This is
|
|
1352
|
+
* useful for decrypting packet captures with tools like Wireshark. Read/write.
|
|
1353
|
+
*
|
|
1354
|
+
* Can also be set via the `onkeylog` option in `quic.connect()` or
|
|
1355
|
+
* `quic.listen()`.
|
|
1356
|
+
* @since v26.2.0
|
|
1357
|
+
*/
|
|
1358
|
+
onkeylog: OnKeylogCallback | undefined;
|
|
1359
|
+
/**
|
|
1360
|
+
* The callback to invoke when qlog data is available. Requires
|
|
1361
|
+
* `sessionOptions.qlog` to be `true`. The callback receives a string
|
|
1362
|
+
* chunk of [JSON-SEQ](https://www.rfc-editor.org/rfc/rfc7464) formatted qlog data and a boolean `fin` flag. When
|
|
1363
|
+
* `fin` is `true`, the chunk is the final qlog output for this session and
|
|
1364
|
+
* the concatenated chunks form a complete qlog trace. Read/write.
|
|
1365
|
+
*
|
|
1366
|
+
* Qlog data arrives during the connection lifecycle. The first chunk contains
|
|
1367
|
+
* the qlog header with format metadata. Subsequent chunks contain trace
|
|
1368
|
+
* events. The final chunk (with `fin` set to `true`) is emitted during
|
|
1369
|
+
* session destruction and completes the JSON-SEQ output.
|
|
1370
|
+
*
|
|
1371
|
+
* Can also be set via the `onqlog` option in `quic.connect()` or
|
|
1372
|
+
* `quic.listen()`.
|
|
1373
|
+
* @since v26.2.0
|
|
1374
|
+
*/
|
|
1375
|
+
onqlog: OnQlogCallback | undefined;
|
|
1376
|
+
/**
|
|
1377
|
+
* Open a new bidirectional stream. If the `body` option is not specified,
|
|
1378
|
+
* the stream's outgoing side remains writable and no FIN is sent
|
|
1379
|
+
* immediately. The `priority` and `incremental`
|
|
1380
|
+
* options are only used when the session supports priority (e.g. HTTP/3).
|
|
1381
|
+
* The `headers`, `onheaders`, `ontrailers`, `oninfo`, and `onwanttrailers`
|
|
1382
|
+
* options are only used when the session supports headers (e.g. HTTP/3).
|
|
1383
|
+
* @since v23.8.0
|
|
1384
|
+
*/
|
|
1385
|
+
createBidirectionalStream(options?: CreateStreamOptions): Promise<QuicStream>;
|
|
1386
|
+
/**
|
|
1387
|
+
* Open a new unidirectional stream. If the `body` option is not specified,
|
|
1388
|
+
* the stream's outgoing side remains writable and no FIN is sent
|
|
1389
|
+
* immediately. The `priority` and `incremental`
|
|
1390
|
+
* options are only used when the session supports priority (e.g. HTTP/3).
|
|
1391
|
+
* @since v23.8.0
|
|
1392
|
+
*/
|
|
1393
|
+
createUnidirectionalStream(options?: CreateStreamOptions): Promise<QuicStream>;
|
|
1394
|
+
/**
|
|
1395
|
+
* The local and remote socket addresses associated with the session. Read only.
|
|
1396
|
+
* @since v23.8.0
|
|
1397
|
+
*/
|
|
1398
|
+
path: SessionPath | undefined;
|
|
1399
|
+
/**
|
|
1400
|
+
* Sends an unreliable datagram to the remote peer, returning a promise for
|
|
1401
|
+
* the datagram ID.
|
|
1402
|
+
*
|
|
1403
|
+
* If `datagram` is a string, it will be encoded using the specified `encoding`.
|
|
1404
|
+
*
|
|
1405
|
+
* If `datagram` is an `ArrayBufferView`, the bytes are copied into an
|
|
1406
|
+
* internal buffer; the caller's source buffer is unchanged and may be reused
|
|
1407
|
+
* or mutated immediately after the call returns. Callers that want to ensure
|
|
1408
|
+
* their source cannot be mutated after the call (for example, when handing
|
|
1409
|
+
* the buffer off to another async consumer) can call
|
|
1410
|
+
* `ArrayBuffer.prototype.transfer()` themselves before passing the buffer.
|
|
1411
|
+
*
|
|
1412
|
+
* If `datagram` is a `Promise`, it will be awaited before sending. If the
|
|
1413
|
+
* session closes while awaiting, `0n` is returned silently (datagrams are
|
|
1414
|
+
* inherently unreliable).
|
|
1415
|
+
*
|
|
1416
|
+
* If the datagram payload is zero-length (empty string after encoding, detached
|
|
1417
|
+
* buffer, or zero-length view), `0n` is returned and no datagram is sent.
|
|
1418
|
+
*
|
|
1419
|
+
* For HTTP/3 sessions, the peer must advertise `SETTINGS_H3_DATAGRAM=1`
|
|
1420
|
+
* (via `application: { enableDatagrams: true }`) for datagrams to be sent.
|
|
1421
|
+
* If the peer's setting is `0`, `sendDatagram()` returns `0n` (per RFC 9297
|
|
1422
|
+
* §3, an endpoint MUST NOT send HTTP Datagrams unless the peer indicated
|
|
1423
|
+
* support).
|
|
1424
|
+
*
|
|
1425
|
+
* Datagrams cannot be fragmented — each must fit within a single QUIC packet.
|
|
1426
|
+
* The maximum datagram size is determined by the peer's
|
|
1427
|
+
* `maxDatagramFrameSize` transport parameter (which the peer advertises during
|
|
1428
|
+
* the handshake). If the peer sets this to `0`, datagrams are not supported
|
|
1429
|
+
* and `0n` will be returned. If the datagram exceeds the peer's limit, it
|
|
1430
|
+
* will be silently dropped and `0n` returned. The local
|
|
1431
|
+
* `maxDatagramFrameSize` transport parameter (default: `1200` bytes) controls
|
|
1432
|
+
* what this endpoint advertises to the peer as its own maximum.
|
|
1433
|
+
* @since v23.8.0
|
|
1434
|
+
* @param encoding The encoding to use if `datagram` is a string.
|
|
1435
|
+
* **Default:** `'utf8'`.
|
|
1436
|
+
*/
|
|
1437
|
+
sendDatagram(
|
|
1438
|
+
datagram: string | NodeJS.ArrayBufferView | Promise<string | NodeJS.ArrayBufferView>,
|
|
1439
|
+
encoding?: BufferEncoding,
|
|
1440
|
+
): Promise<bigint>;
|
|
1441
|
+
/**
|
|
1442
|
+
* The local certificate as a `crypto.X509Certificate` instance. Server
|
|
1443
|
+
* sessions return the certificate configured for the negotiated SNI host.
|
|
1444
|
+
* Client sessions return `undefined` unless a client certificate was sent.
|
|
1445
|
+
* Returns `undefined` if the session is destroyed.
|
|
1446
|
+
* @since v26.2.0
|
|
1447
|
+
*/
|
|
1448
|
+
readonly certificate: X509Certificate | undefined;
|
|
1449
|
+
/**
|
|
1450
|
+
* The peer's certificate as a `crypto.X509Certificate` instance. Returns
|
|
1451
|
+
* `undefined` if the peer did not present a certificate or the session is
|
|
1452
|
+
* destroyed.
|
|
1453
|
+
* @since v26.2.0
|
|
1454
|
+
*/
|
|
1455
|
+
readonly peerCertificate: X509Certificate | undefined;
|
|
1456
|
+
/**
|
|
1457
|
+
* The ephemeral key information for the session, with properties such as
|
|
1458
|
+
* `type`, `name`, and `size`. Only available on client sessions. Returns
|
|
1459
|
+
* `undefined` for server sessions or if the session is destroyed.
|
|
1460
|
+
* @since v26.2.0
|
|
1461
|
+
*/
|
|
1462
|
+
readonly ephemeralKeyInfo: EphemeralKeyInfo | undefined;
|
|
1463
|
+
/**
|
|
1464
|
+
* The maximum datagram payload size in bytes that the peer will accept.
|
|
1465
|
+
* This is derived from the peer's `maxDatagramFrameSize` transport
|
|
1466
|
+
* parameter minus the DATAGRAM frame overhead (type byte and variable-length
|
|
1467
|
+
* integer encoding). Returns `0` if the peer does not support datagrams or
|
|
1468
|
+
* if the handshake has not yet completed. Datagrams larger than this value
|
|
1469
|
+
* will not be sent.
|
|
1470
|
+
* @since v26.2.0
|
|
1471
|
+
*/
|
|
1472
|
+
readonly maxDatagramSize: number;
|
|
1473
|
+
/**
|
|
1474
|
+
* The maximum number of datagrams that can be queued for sending. Datagrams
|
|
1475
|
+
* are queued when `sendDatagram()` is called and sent opportunistically
|
|
1476
|
+
* alongside stream data by the packet serialization loop. When the queue
|
|
1477
|
+
* is full, the `sessionOptions.datagramDropPolicy` determines whether
|
|
1478
|
+
* the oldest or newest datagram is dropped. Dropped datagrams are reported
|
|
1479
|
+
* as lost via the `ondatagramstatus` callback.
|
|
1480
|
+
*
|
|
1481
|
+
* This property can be changed dynamically to adjust queue capacity
|
|
1482
|
+
* based on application activity or memory pressure. The valid range
|
|
1483
|
+
* is `0` to `65535`.
|
|
1484
|
+
* @since v26.2.0
|
|
1485
|
+
*/
|
|
1486
|
+
maxPendingDatagrams: number;
|
|
1487
|
+
/**
|
|
1488
|
+
* Return the current statistics for the session. Read only.
|
|
1489
|
+
* @since v23.8.0
|
|
1490
|
+
*/
|
|
1491
|
+
readonly stats: QuicSession.Stats;
|
|
1492
|
+
/**
|
|
1493
|
+
* Initiate a key update for the session.
|
|
1494
|
+
* @since v23.8.0
|
|
1495
|
+
*/
|
|
1496
|
+
updateKey(): void;
|
|
1497
|
+
/**
|
|
1498
|
+
* Calls `session.close()` and returns a promise that fulfills when the
|
|
1499
|
+
* session has closed.
|
|
1500
|
+
* @since v23.8.0
|
|
1501
|
+
*/
|
|
1502
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
1503
|
+
}
|
|
1504
|
+
namespace QuicSession {
|
|
1505
|
+
/**
|
|
1506
|
+
* @since v23.8.0
|
|
1507
|
+
*/
|
|
1508
|
+
class Stats {
|
|
1509
|
+
private constructor();
|
|
1510
|
+
/**
|
|
1511
|
+
* @since v23.8.0
|
|
1512
|
+
*/
|
|
1513
|
+
readonly createdAt: bigint;
|
|
1514
|
+
/**
|
|
1515
|
+
* @since v23.8.0
|
|
1516
|
+
*/
|
|
1517
|
+
readonly closingAt: bigint;
|
|
1518
|
+
/**
|
|
1519
|
+
* @since v23.8.0
|
|
1520
|
+
*/
|
|
1521
|
+
readonly handshakeCompletedAt: bigint;
|
|
1522
|
+
/**
|
|
1523
|
+
* @since v23.8.0
|
|
1524
|
+
*/
|
|
1525
|
+
readonly handshakeConfirmedAt: bigint;
|
|
1526
|
+
/**
|
|
1527
|
+
* @since v23.8.0
|
|
1528
|
+
*/
|
|
1529
|
+
readonly bytesReceived: bigint;
|
|
1530
|
+
/**
|
|
1531
|
+
* @since v23.8.0
|
|
1532
|
+
*/
|
|
1533
|
+
readonly bytesSent: bigint;
|
|
1534
|
+
/**
|
|
1535
|
+
* @since v23.8.0
|
|
1536
|
+
*/
|
|
1537
|
+
readonly bidiInStreamCount: bigint;
|
|
1538
|
+
/**
|
|
1539
|
+
* @since v23.8.0
|
|
1540
|
+
*/
|
|
1541
|
+
readonly bidiOutStreamCount: bigint;
|
|
1542
|
+
/**
|
|
1543
|
+
* @since v23.8.0
|
|
1544
|
+
*/
|
|
1545
|
+
readonly uniInStreamCount: bigint;
|
|
1546
|
+
/**
|
|
1547
|
+
* @since v23.8.0
|
|
1548
|
+
*/
|
|
1549
|
+
readonly uniOutStreamCount: bigint;
|
|
1550
|
+
/**
|
|
1551
|
+
* @since v23.8.0
|
|
1552
|
+
*/
|
|
1553
|
+
readonly maxBytesInFlight: bigint;
|
|
1554
|
+
/**
|
|
1555
|
+
* @since v23.8.0
|
|
1556
|
+
*/
|
|
1557
|
+
readonly bytesInFlight: bigint;
|
|
1558
|
+
/**
|
|
1559
|
+
* @since v23.8.0
|
|
1560
|
+
*/
|
|
1561
|
+
readonly blockCount: bigint;
|
|
1562
|
+
/**
|
|
1563
|
+
* @since v23.8.0
|
|
1564
|
+
*/
|
|
1565
|
+
readonly cwnd: bigint;
|
|
1566
|
+
/**
|
|
1567
|
+
* @since v23.8.0
|
|
1568
|
+
*/
|
|
1569
|
+
readonly latestRtt: bigint;
|
|
1570
|
+
/**
|
|
1571
|
+
* @since v23.8.0
|
|
1572
|
+
*/
|
|
1573
|
+
readonly minRtt: bigint;
|
|
1574
|
+
/**
|
|
1575
|
+
* @since v23.8.0
|
|
1576
|
+
*/
|
|
1577
|
+
readonly rttVar: bigint;
|
|
1578
|
+
/**
|
|
1579
|
+
* @since v23.8.0
|
|
1580
|
+
*/
|
|
1581
|
+
readonly smoothedRtt: bigint;
|
|
1582
|
+
/**
|
|
1583
|
+
* @since v23.8.0
|
|
1584
|
+
*/
|
|
1585
|
+
readonly ssthresh: bigint;
|
|
1586
|
+
/**
|
|
1587
|
+
* @since v23.8.0
|
|
1588
|
+
*/
|
|
1589
|
+
readonly datagramsReceived: bigint;
|
|
1590
|
+
/**
|
|
1591
|
+
* @since v23.8.0
|
|
1592
|
+
*/
|
|
1593
|
+
readonly datagramsSent: bigint;
|
|
1594
|
+
/**
|
|
1595
|
+
* @since v23.8.0
|
|
1596
|
+
*/
|
|
1597
|
+
readonly datagramsAcknowledged: bigint;
|
|
1598
|
+
/**
|
|
1599
|
+
* @since v23.8.0
|
|
1600
|
+
*/
|
|
1601
|
+
readonly datagramsLost: bigint;
|
|
1602
|
+
/**
|
|
1603
|
+
* The total number of peer-initiated streams destroyed by the
|
|
1604
|
+
* stream idle timeout. Read only.
|
|
1605
|
+
* @since v26.3.0
|
|
1606
|
+
*/
|
|
1607
|
+
readonly streamsIdleTimedOut: bigint;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
interface QuicErrorOptions {
|
|
1611
|
+
/**
|
|
1612
|
+
* The numeric QUIC error code. Numbers
|
|
1613
|
+
* are coerced to `BigInt`. Must be a non-negative 62-bit unsigned
|
|
1614
|
+
* varint (`0n <= errorCode <= 2n ** 62n - 1n`).
|
|
1615
|
+
*/
|
|
1616
|
+
errorCode?: bigint | number | undefined;
|
|
1617
|
+
/**
|
|
1618
|
+
* The Node.js-style error code string assigned to
|
|
1619
|
+
* `error.code`. Defaults to `'ERR_QUIC_STREAM_ABORTED'`.
|
|
1620
|
+
*/
|
|
1621
|
+
code?: string | undefined;
|
|
1622
|
+
/**
|
|
1623
|
+
* Either `'application'` (default) or `'transport'`.
|
|
1624
|
+
* Indicates whether the code is defined by the negotiated
|
|
1625
|
+
* application protocol (e.g. RFC 9114 for HTTP/3) or by the QUIC
|
|
1626
|
+
* transport layer (RFC 9000). Stream resets always carry application
|
|
1627
|
+
* codes, so the default is `'application'`.
|
|
1628
|
+
*/
|
|
1629
|
+
type?: "application" | "transport" | undefined;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* A `QuicError` is an `Error` subclass that carries an explicit numeric
|
|
1633
|
+
* QUIC error code. Use it to abort a QUIC stream or session with a
|
|
1634
|
+
* specific application-protocol-defined error code rather than letting
|
|
1635
|
+
* the implementation pick a generic fallback.
|
|
1636
|
+
*
|
|
1637
|
+
* The class is exported from `node:quic`:
|
|
1638
|
+
*
|
|
1639
|
+
* ```js
|
|
1640
|
+
* import { QuicError } from 'node:quic';
|
|
1641
|
+
* ```
|
|
1642
|
+
*
|
|
1643
|
+
* When a `QuicError` is supplied to APIs that emit a wire frame
|
|
1644
|
+
* (`writer.fail()`, `stream.destroy()`), the QUIC stack uses
|
|
1645
|
+
* `error.errorCode` as the wire code for the resulting frame.
|
|
1646
|
+
* When any other value is supplied (for example a plain `Error`), the
|
|
1647
|
+
* implementation falls back to the negotiated application protocol's
|
|
1648
|
+
* "internal error" code (`H3_INTERNAL_ERROR` (`0x102`) for HTTP/3, or
|
|
1649
|
+
* the QUIC transport-layer `INTERNAL_ERROR` (`0x1`) for raw QUIC).
|
|
1650
|
+
*
|
|
1651
|
+
* The Node.js error code (`error.code`) defaults to
|
|
1652
|
+
* `'ERR_QUIC_STREAM_ABORTED'`. Callers who need a more specific code
|
|
1653
|
+
* string can override it via `options.code` — the numeric QUIC code
|
|
1654
|
+
* is unaffected.
|
|
1655
|
+
*
|
|
1656
|
+
* The Node.js error code is fixed at `'ERR_QUIC_STREAM_ABORTED'` so that
|
|
1657
|
+
* catch blocks can distinguish a `QuicError` from other Node.js errors
|
|
1658
|
+
* without checking the prototype chain. The numeric QUIC code lives on
|
|
1659
|
+
* the separate `error.errorCode` property to avoid colliding with
|
|
1660
|
+
* the Node.js convention that `error.code` is a string.
|
|
1661
|
+
* @since v26.2.0
|
|
1662
|
+
* @experimental
|
|
1663
|
+
*/
|
|
1664
|
+
class QuicError extends Error {
|
|
1665
|
+
/**
|
|
1666
|
+
* ```js
|
|
1667
|
+
* import { QuicError } from 'node:quic';
|
|
1668
|
+
*
|
|
1669
|
+
* const err = new QuicError('rejecting stream', { errorCode: 0x10cn });
|
|
1670
|
+
* console.log(err.code); // 'ERR_QUIC_STREAM_ABORTED'
|
|
1671
|
+
* console.log(err.errorCode); // 268n
|
|
1672
|
+
* console.log(err.type); // 'application'
|
|
1673
|
+
*
|
|
1674
|
+
* const custom = new QuicError('custom failure', {
|
|
1675
|
+
* errorCode: 0x10cn,
|
|
1676
|
+
* code: 'ERR_MY_QUIC_FAILURE',
|
|
1677
|
+
* });
|
|
1678
|
+
* console.log(custom.code); // 'ERR_MY_QUIC_FAILURE'
|
|
1679
|
+
* ```
|
|
1680
|
+
* @param message A human-readable description of the error.
|
|
1681
|
+
*/
|
|
1682
|
+
constructor(message: string, options?: QuicErrorOptions);
|
|
1683
|
+
/**
|
|
1684
|
+
* The numeric QUIC error code carried by this error.
|
|
1685
|
+
* @since v26.2.0
|
|
1686
|
+
*/
|
|
1687
|
+
readonly errorCode: bigint;
|
|
1688
|
+
/**
|
|
1689
|
+
* Either `'application'` or `'transport'`. Indicates the namespace of
|
|
1690
|
+
* `error.errorCode`.
|
|
1691
|
+
* @since v26.2.0
|
|
1692
|
+
*/
|
|
1693
|
+
readonly type: "application" | "transport";
|
|
1694
|
+
}
|
|
1695
|
+
type StreamBody =
|
|
1696
|
+
| null
|
|
1697
|
+
| string
|
|
1698
|
+
| ArrayBufferLike
|
|
1699
|
+
| NodeJS.ArrayBufferView
|
|
1700
|
+
| Blob
|
|
1701
|
+
| FileHandle
|
|
1702
|
+
| Iterable<string | Uint8Array>
|
|
1703
|
+
| AsyncIterable<string | Uint8Array>
|
|
1704
|
+
| Promise<StreamBody>;
|
|
1705
|
+
interface StreamPriority {
|
|
1706
|
+
/**
|
|
1707
|
+
* One of `'high'`, `'default'`, or `'low'`.
|
|
1708
|
+
*/
|
|
1709
|
+
level: "high" | "default" | "low";
|
|
1710
|
+
/**
|
|
1711
|
+
* Whether the stream data should be interleaved
|
|
1712
|
+
* with other streams of the same priority level.
|
|
1713
|
+
*/
|
|
1714
|
+
incremental: boolean;
|
|
1715
|
+
}
|
|
1716
|
+
interface StreamDestroyOptions {
|
|
1717
|
+
/**
|
|
1718
|
+
* The application error code to include in the
|
|
1719
|
+
* `RESET_STREAM` and `STOP_SENDING` frames sent to the peer. Numbers are
|
|
1720
|
+
* coerced to `BigInt`. When omitted, the wire code is derived from `error`
|
|
1721
|
+
* (see below).
|
|
1722
|
+
*/
|
|
1723
|
+
code?: bigint | number | undefined;
|
|
1724
|
+
/**
|
|
1725
|
+
* An optional human-readable reason string. Accepted for
|
|
1726
|
+
* symmetry with `session.close()` and `session.destroy()`, but
|
|
1727
|
+
* **not transmitted on the wire** — neither `RESET_STREAM` nor
|
|
1728
|
+
* `STOP_SENDING` carry a reason field. Provided for application logging
|
|
1729
|
+
* and for use by the `stream.onerror` callback.
|
|
1730
|
+
*/
|
|
1731
|
+
reason?: string | undefined;
|
|
1732
|
+
}
|
|
1733
|
+
interface StreamSendHeadersOptions {
|
|
1734
|
+
/**
|
|
1735
|
+
* If `true`, the stream is closed for sending
|
|
1736
|
+
* after the headers (no body will follow). **Default:** `false`.
|
|
1737
|
+
*/
|
|
1738
|
+
terminal?: boolean | undefined;
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* @since v23.8.0
|
|
1742
|
+
*/
|
|
1743
|
+
class QuicStream {
|
|
1744
|
+
private constructor();
|
|
1745
|
+
/**
|
|
1746
|
+
* A promise that is fulfilled when the stream is fully closed. It resolves
|
|
1747
|
+
* when the stream closes cleanly (including idle timeout). It rejects with
|
|
1748
|
+
* an `ERR_QUIC_APPLICATION_ERROR` or `ERR_QUIC_TRANSPORT_ERROR` when the
|
|
1749
|
+
* stream is closed due to a QUIC error (e.g., stream reset by the peer,
|
|
1750
|
+
* CONNECTION\_CLOSE with a non-zero error code).
|
|
1751
|
+
* @since v23.8.0
|
|
1752
|
+
*/
|
|
1753
|
+
readonly closed: Promise<void>;
|
|
1754
|
+
/**
|
|
1755
|
+
* Immediately and abruptly destroys the stream. If `error` is provided and
|
|
1756
|
+
* `stream.onerror` is set, the `onerror` callback is invoked before
|
|
1757
|
+
* destruction. The `stream.closed` promise rejects with the error.
|
|
1758
|
+
*
|
|
1759
|
+
* When the stream is destroyed with an `error` (or with an explicit
|
|
1760
|
+
* `options.code`), the QUIC stack signals the abort to the peer:
|
|
1761
|
+
*
|
|
1762
|
+
* * If the writable side is still open, a `RESET_STREAM` frame is sent.
|
|
1763
|
+
* * If the readable side is still open (a bidirectional stream, or a
|
|
1764
|
+
* remote-initiated unidirectional stream), a `STOP_SENDING` frame is sent.
|
|
1765
|
+
*
|
|
1766
|
+
* Both frames carry the same wire code, resolved with the following
|
|
1767
|
+
* precedence:
|
|
1768
|
+
*
|
|
1769
|
+
* 1. `options.code`, when explicitly provided.
|
|
1770
|
+
* 2. [`error.errorCode`][], when `error` is a [`QuicError`][].
|
|
1771
|
+
* 3. The negotiated application protocol's "internal error" code
|
|
1772
|
+
* (`H3_INTERNAL_ERROR` (`0x102`) for HTTP/3, or the QUIC transport-layer
|
|
1773
|
+
* `INTERNAL_ERROR` (`0x1`) for raw QUIC).
|
|
1774
|
+
*
|
|
1775
|
+
* A clean destroy — no `error` and no `options.code` — does not emit
|
|
1776
|
+
* `RESET_STREAM` or `STOP_SENDING`; the stream's existing close machinery
|
|
1777
|
+
* handles teardown.
|
|
1778
|
+
*
|
|
1779
|
+
* See [Aborting a stream](https://nodejs.org/docs/latest-v26.x/api/quic.html#aborting-a-stream) for an overview of the available stream-abort
|
|
1780
|
+
* APIs.
|
|
1781
|
+
* @since v23.8.0
|
|
1782
|
+
*/
|
|
1783
|
+
destroy(error?: any, options?: StreamDestroyOptions): void;
|
|
1784
|
+
/**
|
|
1785
|
+
* True if `stream.destroy()` has been called.
|
|
1786
|
+
* @since v23.8.0
|
|
1787
|
+
*/
|
|
1788
|
+
readonly destroyed: boolean;
|
|
1789
|
+
/**
|
|
1790
|
+
* True if any data on this stream was received as 0-RTT (early data)
|
|
1791
|
+
* before the TLS handshake completed. Early data is less secure and
|
|
1792
|
+
* could potentially be replayed by an attacker. Applications should
|
|
1793
|
+
* treat early data with appropriate caution.
|
|
1794
|
+
*
|
|
1795
|
+
* This property is only meaningful on the server side. On the client
|
|
1796
|
+
* side, it is always `false`.
|
|
1797
|
+
* @since v26.2.0
|
|
1798
|
+
*/
|
|
1799
|
+
readonly early: boolean;
|
|
1800
|
+
/**
|
|
1801
|
+
* The directionality of the stream, or `null` if the stream has been destroyed
|
|
1802
|
+
* or is still pending. Read only.
|
|
1803
|
+
* @since v23.8.0
|
|
1804
|
+
*/
|
|
1805
|
+
readonly direction: "bidi" | "uni" | null;
|
|
1806
|
+
/**
|
|
1807
|
+
* The maximum number of bytes that the writer will buffer before
|
|
1808
|
+
* `writeSync()` returns `false`. When the buffered data exceeds this limit,
|
|
1809
|
+
* the caller should wait for drain before writing more.
|
|
1810
|
+
*
|
|
1811
|
+
* The value can be changed dynamically at any time. This is particularly
|
|
1812
|
+
* useful for streams received via the `onstream` callback, where the
|
|
1813
|
+
* default (65536) may need to be adjusted based on application needs.
|
|
1814
|
+
* The valid range is `0` to `4294967295`.
|
|
1815
|
+
* @since v26.2.0
|
|
1816
|
+
*/
|
|
1817
|
+
highWaterMark: number;
|
|
1818
|
+
/**
|
|
1819
|
+
* The stream ID, or `null` if the stream has been destroyed or is still
|
|
1820
|
+
* pending. Read only.
|
|
1821
|
+
* @since v23.8.0
|
|
1822
|
+
*/
|
|
1823
|
+
readonly id: bigint | null;
|
|
1824
|
+
/**
|
|
1825
|
+
* An optional callback invoked when the stream is destroyed with an error.
|
|
1826
|
+
* This includes errors caused by user callbacks that throw or reject (see
|
|
1827
|
+
* [Callback error handling](https://nodejs.org/docs/latest-26.x/api/quic.html#callback-error-handling)). The callback receives a single argument: the
|
|
1828
|
+
* error that triggered the destruction. If the `onerror` callback itself throws
|
|
1829
|
+
* or returns a promise that rejects, the error is surfaced as an uncaught
|
|
1830
|
+
* exception. Read/write.
|
|
1831
|
+
* @since v26.2.0
|
|
1832
|
+
*/
|
|
1833
|
+
onerror: ((this: QuicStream, error: any) => void) | undefined;
|
|
1834
|
+
/**
|
|
1835
|
+
* The callback to invoke when the stream is blocked. Read/write.
|
|
1836
|
+
* @since v23.8.0
|
|
1837
|
+
*/
|
|
1838
|
+
onblocked: OnBlockedCallback | undefined;
|
|
1839
|
+
/**
|
|
1840
|
+
* The callback to invoke when the peer aborts a direction of the stream by
|
|
1841
|
+
* sending a `RESET_STREAM` frame (the peer abandons their writable side, so
|
|
1842
|
+
* no further data will arrive on our readable side) or a `STOP_SENDING`
|
|
1843
|
+
* frame (the peer asks us to stop writing on our writable side).
|
|
1844
|
+
*
|
|
1845
|
+
* The callback receives a Node.js error whose `errorCode` (`bigint`)
|
|
1846
|
+
* property carries the application error code from the wire frame.
|
|
1847
|
+
*
|
|
1848
|
+
* The stream is **not** automatically destroyed when this callback fires —
|
|
1849
|
+
* the application chooses how to react. Common patterns are: ignore (and
|
|
1850
|
+
* continue using the still-active direction on a bidirectional stream),
|
|
1851
|
+
* abort the other direction with `writer.fail()`, or tear down the
|
|
1852
|
+
* whole stream with `stream.destroy()`. Read/write.
|
|
1853
|
+
* @since v23.8.0
|
|
1854
|
+
*/
|
|
1855
|
+
onreset: OnStreamErrorCallback | undefined;
|
|
1856
|
+
/**
|
|
1857
|
+
* The buffered initial headers received on this stream, or `undefined` if the
|
|
1858
|
+
* application does not support headers or no headers have been received yet.
|
|
1859
|
+
* For server-side streams, this contains the request headers (e.g., `:method`,
|
|
1860
|
+
* `:path`, `:scheme`). For client-side streams, this contains the response
|
|
1861
|
+
* headers (e.g., `:status`).
|
|
1862
|
+
*
|
|
1863
|
+
* Header names are lowercase strings. Multi-value headers are represented as
|
|
1864
|
+
* arrays. The object has `__proto__: null`.
|
|
1865
|
+
* @since v26.2.0
|
|
1866
|
+
*/
|
|
1867
|
+
readonly headers: NodeJS.Dict<string | string[]> | undefined;
|
|
1868
|
+
/**
|
|
1869
|
+
* The callback to invoke when initial headers are received on the stream. The
|
|
1870
|
+
* callback receives `(headers)` where `headers` is an object (same format as
|
|
1871
|
+
* `stream.headers`). For HTTP/3, this delivers request pseudo-headers on the
|
|
1872
|
+
* server side and response headers on the client side. Throws
|
|
1873
|
+
* `ERR_INVALID_STATE` if set on a session that does not support headers.
|
|
1874
|
+
* Read/write.
|
|
1875
|
+
* @since v26.2.0
|
|
1876
|
+
*/
|
|
1877
|
+
onheaders: ((this: QuicStream, headers: NodeJS.Dict<string | string[]>) => void) | undefined;
|
|
1878
|
+
/**
|
|
1879
|
+
* The callback to invoke when trailing headers are received from the peer.
|
|
1880
|
+
* The callback receives `(trailers)` where `trailers` is an object in the
|
|
1881
|
+
* same format as `stream.headers`. Throws `ERR_INVALID_STATE` if set on a
|
|
1882
|
+
* session that does not support headers. Read/write.
|
|
1883
|
+
* @since v26.2.0
|
|
1884
|
+
*/
|
|
1885
|
+
ontrailers: ((this: QuicStream, trailers: NodeJS.Dict<string | string[]>) => void) | undefined;
|
|
1886
|
+
/**
|
|
1887
|
+
* The callback to invoke when informational (1xx) headers are received from
|
|
1888
|
+
* the server. The callback receives `(headers)` where `headers` is an object
|
|
1889
|
+
* in the same format as `stream.headers`. Informational headers are sent
|
|
1890
|
+
* before the final response (e.g., 103 Early Hints). Throws
|
|
1891
|
+
* `ERR_INVALID_STATE` if set on a session that does not support headers.
|
|
1892
|
+
* Read/write.
|
|
1893
|
+
* @since v26.2.0
|
|
1894
|
+
*/
|
|
1895
|
+
oninfo: ((this: QuicStream, headers: NodeJS.Dict<string | string[]>) => void) | undefined;
|
|
1896
|
+
/**
|
|
1897
|
+
* The callback to invoke when the application is ready for trailing headers
|
|
1898
|
+
* to be sent. This is called synchronously — the user must call
|
|
1899
|
+
* `stream.sendTrailers()` within this callback. Throws
|
|
1900
|
+
* `ERR_INVALID_STATE` if set on a session that does not support headers.
|
|
1901
|
+
* Read/write.
|
|
1902
|
+
* @since v26.2.0
|
|
1903
|
+
*/
|
|
1904
|
+
onwanttrailers: ((this: QuicStream) => void) | undefined;
|
|
1905
|
+
/**
|
|
1906
|
+
* Set trailing headers to be sent automatically when the application requests
|
|
1907
|
+
* them. This is an alternative to the `stream.onwanttrailers` callback
|
|
1908
|
+
* for cases where the trailers are known before the body completes. Throws
|
|
1909
|
+
* `ERR_INVALID_STATE` if set on a session that does not support headers.
|
|
1910
|
+
* Read/write.
|
|
1911
|
+
* @since v26.2.0
|
|
1912
|
+
*/
|
|
1913
|
+
pendingTrailers: NodeJS.Dict<string | string[]> | undefined;
|
|
1914
|
+
/**
|
|
1915
|
+
* Sends initial or response headers on the stream. For client-side streams,
|
|
1916
|
+
* this sends request headers. For server-side streams, this sends response
|
|
1917
|
+
* headers. Throws `ERR_INVALID_STATE` if the session does not support headers.
|
|
1918
|
+
* @since v26.2.0
|
|
1919
|
+
* @param headers Header object with string keys and string or
|
|
1920
|
+
* string-array values. Pseudo-headers (`:method`, `:path`, etc.) must
|
|
1921
|
+
* appear before regular headers.
|
|
1922
|
+
*/
|
|
1923
|
+
sendHeaders(headers: NodeJS.Dict<string | string[]>, options?: StreamSendHeadersOptions): boolean;
|
|
1924
|
+
/**
|
|
1925
|
+
* Sends informational (1xx) response headers. Server only. Throws
|
|
1926
|
+
* `ERR_INVALID_STATE` if the session does not support headers.
|
|
1927
|
+
* @since v26.2.0
|
|
1928
|
+
* @param headers Header object. Must include `:status` with a 1xx
|
|
1929
|
+
* value (e.g., `{ ':status': '103', 'link': '</style.css>; rel=preload' }`).
|
|
1930
|
+
*/
|
|
1931
|
+
sendInformationalHeaders(headers: NodeJS.Dict<string | string[]>): boolean;
|
|
1932
|
+
/**
|
|
1933
|
+
* Sends trailing headers on the stream. Must be called synchronously during
|
|
1934
|
+
* the `stream.onwanttrailers` callback, or set ahead of time via
|
|
1935
|
+
* `stream.pendingTrailers`. Throws `ERR_INVALID_STATE` if the session
|
|
1936
|
+
* does not support headers.
|
|
1937
|
+
* @since v26.2.0
|
|
1938
|
+
* @param headers Trailing header object. Pseudo-headers must not be
|
|
1939
|
+
* included in trailers.
|
|
1940
|
+
*/
|
|
1941
|
+
sendTrailers(headers: NodeJS.Dict<string | string[]>): boolean;
|
|
1942
|
+
/**
|
|
1943
|
+
* The current priority of the stream. Returns `null` if the session does not
|
|
1944
|
+
* support priority (e.g. non-HTTP/3) or if the stream has been destroyed.
|
|
1945
|
+
* Read only. Use `stream.setPriority()` to change the priority.
|
|
1946
|
+
*
|
|
1947
|
+
* On client-side HTTP/3 sessions, the value reflects what was set via
|
|
1948
|
+
* `stream.setPriority()`. On server-side HTTP/3 sessions, the value
|
|
1949
|
+
* reflects the peer's requested priority (e.g., from `PRIORITY_UPDATE` frames).
|
|
1950
|
+
* @since v26.2.0
|
|
1951
|
+
*/
|
|
1952
|
+
readonly priority: StreamPriority | null;
|
|
1953
|
+
/**
|
|
1954
|
+
* Sets the priority of the stream. Throws `ERR_INVALID_STATE` if the session
|
|
1955
|
+
* does not support priority (e.g. non-HTTP/3). Has no effect if the stream
|
|
1956
|
+
* has been destroyed.
|
|
1957
|
+
* @since v26.2.0
|
|
1958
|
+
*/
|
|
1959
|
+
setPriority(options?: NodeJS.PartialOptions<StreamPriority>): void;
|
|
1960
|
+
/**
|
|
1961
|
+
* The stream implements `Symbol.asyncIterator`, making it directly usable
|
|
1962
|
+
* in `for await...of` loops. Each iteration yields a batch of `Uint8Array`
|
|
1963
|
+
* chunks.
|
|
1964
|
+
*
|
|
1965
|
+
* Only one async iterator can be obtained per stream. A second call throws
|
|
1966
|
+
* `ERR_INVALID_STATE`. Non-readable streams (outbound-only unidirectional
|
|
1967
|
+
* or closed) return an immediately-finished iterator.
|
|
1968
|
+
*
|
|
1969
|
+
* ```js
|
|
1970
|
+
* for await (const chunks of stream) {
|
|
1971
|
+
* for (const chunk of chunks) {
|
|
1972
|
+
* // Process each Uint8Array chunk
|
|
1973
|
+
* }
|
|
1974
|
+
* }
|
|
1975
|
+
* ```
|
|
1976
|
+
*
|
|
1977
|
+
* Compatible with stream/iter utilities:
|
|
1978
|
+
*
|
|
1979
|
+
* ```js
|
|
1980
|
+
* import Stream from 'node:stream/iter';
|
|
1981
|
+
* const body = await Stream.bytes(stream);
|
|
1982
|
+
* const text = await Stream.text(stream);
|
|
1983
|
+
* await Stream.pipeTo(stream, someWriter);
|
|
1984
|
+
* ```
|
|
1985
|
+
* @since v26.2.0
|
|
1986
|
+
*/
|
|
1987
|
+
[Symbol.asyncIterator](): NodeJS.AsyncIterator<NodeJS.NonSharedUint8Array[]>;
|
|
1988
|
+
/**
|
|
1989
|
+
* Returns a Writer object for pushing data to the stream incrementally.
|
|
1990
|
+
* The Writer implements the stream/iter Writer interface with the
|
|
1991
|
+
* try-sync-fallback-to-async pattern.
|
|
1992
|
+
*
|
|
1993
|
+
* Only available when no `body` source was provided at creation time or via
|
|
1994
|
+
* `stream.setBody()`. Non-writable streams return an already-closed
|
|
1995
|
+
* Writer. Throws `ERR_INVALID_STATE` if the outbound is already configured.
|
|
1996
|
+
*
|
|
1997
|
+
* The Writer has the following methods:
|
|
1998
|
+
*
|
|
1999
|
+
* * `writeSync(chunk)` — Synchronous write. Returns `true` if accepted,
|
|
2000
|
+
* `false` if flow-controlled. Data is NOT accepted on `false`.
|
|
2001
|
+
* * `write(chunk[, options])` — Async write with drain wait. `options.signal`
|
|
2002
|
+
* is checked at entry but not observed during the write.
|
|
2003
|
+
* * `writevSync(chunks)` — Synchronous vectored write. All-or-nothing.
|
|
2004
|
+
* * `writev(chunks[, options])` — Async vectored write.
|
|
2005
|
+
* * `endSync()` — Synchronous close. Returns total bytes or `-1`.
|
|
2006
|
+
* * `end([options])` — Async close.
|
|
2007
|
+
* * `fail(reason)` — Errors the stream (sends `RESET_STREAM` to peer).
|
|
2008
|
+
* When `reason` is a `QuicError`, its `error.errorCode` is used
|
|
2009
|
+
* as the wire code on the resulting `RESET_STREAM` frame; otherwise
|
|
2010
|
+
* the wire code falls back to the negotiated application protocol's
|
|
2011
|
+
* "internal error" code (`H3_INTERNAL_ERROR` (`0x102`) for HTTP/3, or
|
|
2012
|
+
* the QUIC transport-layer `INTERNAL_ERROR` (`0x1`) for raw QUIC).
|
|
2013
|
+
* See `stream.destroy()` for a full-stream abort that also resets
|
|
2014
|
+
* the readable side via `STOP_SENDING`.
|
|
2015
|
+
* * `desiredSize` — Available capacity in bytes, or `null` if closed/errored.
|
|
2016
|
+
*
|
|
2017
|
+
* The bytes from each `writeSync()` / `writevSync()` / `write()` / `writev()`
|
|
2018
|
+
* input chunk are copied into an internal buffer, so the caller's source
|
|
2019
|
+
* buffer is unchanged and may be reused or mutated immediately after the
|
|
2020
|
+
* call returns. Callers that want to ensure a source buffer cannot be
|
|
2021
|
+
* mutated after handing it off can call `ArrayBuffer.prototype.transfer()`
|
|
2022
|
+
* themselves before passing the buffer.
|
|
2023
|
+
* @since v26.2.0
|
|
2024
|
+
*/
|
|
2025
|
+
readonly writer: Writer;
|
|
2026
|
+
/**
|
|
2027
|
+
* Sets the outbound body source for the stream. Can only be called once.
|
|
2028
|
+
* Mutually exclusive with `stream.writer`.
|
|
2029
|
+
*
|
|
2030
|
+
* The following body source types are supported:
|
|
2031
|
+
*
|
|
2032
|
+
* * `null` — The writable side is closed immediately (FIN sent with no data).
|
|
2033
|
+
* * `string` — UTF-8 encoded and sent as a single chunk.
|
|
2034
|
+
* * `ArrayBuffer`, `SharedArrayBuffer`, `ArrayBufferView` — Sent as a single
|
|
2035
|
+
* chunk. The bytes are copied into an internal buffer, so the caller's
|
|
2036
|
+
* source buffer is unchanged and may be reused or mutated immediately
|
|
2037
|
+
* after the call returns. Callers wanting to ensure their source cannot
|
|
2038
|
+
* be mutated after handing it off can call
|
|
2039
|
+
* `ArrayBuffer.prototype.transfer()` themselves before passing the buffer.
|
|
2040
|
+
* * `Blob` — Sent from the Blob's underlying data queue.
|
|
2041
|
+
* * {FileHandle} — The file contents are read asynchronously via an
|
|
2042
|
+
* fd-backed data source. The `FileHandle` must be opened for reading
|
|
2043
|
+
* (e.g. via [`fs.promises.open(path, 'r')`][]). Once passed as a body, the
|
|
2044
|
+
* `FileHandle` is locked and cannot be used as a body for another stream.
|
|
2045
|
+
* The `FileHandle` is automatically closed when the stream finishes.
|
|
2046
|
+
* * `AsyncIterable`, `Iterable` — Each yielded chunk (string or
|
|
2047
|
+
* `Uint8Array`) is written incrementally in streaming mode.
|
|
2048
|
+
* * `Promise` — Awaited; the resolved value is used as the body (subject
|
|
2049
|
+
* to the same type rules).
|
|
2050
|
+
*
|
|
2051
|
+
* Throws `ERR_INVALID_STATE` if the outbound is already configured or if
|
|
2052
|
+
* the writer has been accessed.
|
|
2053
|
+
* @since v26.2.0
|
|
2054
|
+
*/
|
|
2055
|
+
setBody(body: StreamBody): void;
|
|
2056
|
+
/**
|
|
2057
|
+
* The session that created this stream, or `null` if the stream has been
|
|
2058
|
+
* destroyed. Read only.
|
|
2059
|
+
* @since v23.8.0
|
|
2060
|
+
*/
|
|
2061
|
+
readonly session: QuicSession | null;
|
|
2062
|
+
/**
|
|
2063
|
+
* The current statistics for the stream. Read only.
|
|
2064
|
+
* @since v23.8.0
|
|
2065
|
+
*/
|
|
2066
|
+
readonly stats: QuicStream.Stats;
|
|
2067
|
+
}
|
|
2068
|
+
namespace QuicStream {
|
|
2069
|
+
/**
|
|
2070
|
+
* @since v23.8.0
|
|
2071
|
+
*/
|
|
2072
|
+
class Stats {
|
|
2073
|
+
private constructor();
|
|
2074
|
+
/**
|
|
2075
|
+
* @since v23.8.0
|
|
2076
|
+
*/
|
|
2077
|
+
readonly ackedAt: bigint;
|
|
2078
|
+
/**
|
|
2079
|
+
* @since v23.8.0
|
|
2080
|
+
*/
|
|
2081
|
+
readonly bytesReceived: bigint;
|
|
2082
|
+
/**
|
|
2083
|
+
* @since v23.8.0
|
|
2084
|
+
*/
|
|
2085
|
+
readonly bytesSent: bigint;
|
|
2086
|
+
/**
|
|
2087
|
+
* @since v23.8.0
|
|
2088
|
+
*/
|
|
2089
|
+
readonly createdAt: bigint;
|
|
2090
|
+
/**
|
|
2091
|
+
* @since v23.8.0
|
|
2092
|
+
*/
|
|
2093
|
+
readonly destroyedAt: bigint;
|
|
2094
|
+
/**
|
|
2095
|
+
* @since v23.8.0
|
|
2096
|
+
*/
|
|
2097
|
+
readonly finalSize: bigint;
|
|
2098
|
+
/**
|
|
2099
|
+
* @since v23.8.0
|
|
2100
|
+
*/
|
|
2101
|
+
readonly isConnected: bigint;
|
|
2102
|
+
/**
|
|
2103
|
+
* @since v23.8.0
|
|
2104
|
+
*/
|
|
2105
|
+
readonly maxOffset: bigint;
|
|
2106
|
+
/**
|
|
2107
|
+
* @since v23.8.0
|
|
2108
|
+
*/
|
|
2109
|
+
readonly maxOffsetAcknowledged: bigint;
|
|
2110
|
+
/**
|
|
2111
|
+
* @since v23.8.0
|
|
2112
|
+
*/
|
|
2113
|
+
readonly maxOffsetReceived: bigint;
|
|
2114
|
+
/**
|
|
2115
|
+
* @since v23.8.0
|
|
2116
|
+
*/
|
|
2117
|
+
readonly openedAt: bigint;
|
|
2118
|
+
/**
|
|
2119
|
+
* @since v23.8.0
|
|
2120
|
+
*/
|
|
2121
|
+
readonly receivedAt: bigint;
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
/**
|
|
2125
|
+
* An object containing commonly used constants for QUIC configuration.
|
|
2126
|
+
* @since v26.2.0
|
|
2127
|
+
*/
|
|
2128
|
+
namespace constants {
|
|
2129
|
+
/**
|
|
2130
|
+
* Congestion control algorithm identifiers, for use with the
|
|
2131
|
+
* `sessionOptions.cc` option:
|
|
2132
|
+
*
|
|
2133
|
+
* * `quic.constants.cc.RENO` — Reno congestion control.
|
|
2134
|
+
* * `quic.constants.cc.CUBIC` — CUBIC congestion control.
|
|
2135
|
+
* * `quic.constants.cc.BBR` — BBR congestion control.
|
|
2136
|
+
*/
|
|
2137
|
+
enum cc {
|
|
2138
|
+
RENO = "reno",
|
|
2139
|
+
CUBIC = "cubic",
|
|
2140
|
+
BBR = "bbr",
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* The default TLS 1.3 cipher suite list used when `sessionOptions.ciphers`
|
|
2144
|
+
* is not specified.
|
|
2145
|
+
*/
|
|
2146
|
+
const DEFAULT_CIPHERS: string;
|
|
2147
|
+
/**
|
|
2148
|
+
* The default TLS 1.3 key-exchange group list used when
|
|
2149
|
+
* `sessionOptions.groups` is not specified.
|
|
2150
|
+
*/
|
|
2151
|
+
const DEFAULT_GROUPS: string;
|
|
2152
|
+
}
|
|
2153
|
+
}
|