- assert 断言
- async_hooks 异步钩子
- async_hooks/context 异步上下文
- buffer 缓冲区
- C++插件
- C/C++插件(使用 Node-API)
- C++嵌入器
- child_process 子进程
- cluster 集群
- CLI 命令行
- console 控制台
- crypto 加密
- crypto/webcrypto 网络加密
- debugger 调试器
- deprecation 弃用
- dgram 数据报
- diagnostics_channel 诊断通道
- dns 域名服务器
- domain 域
- Error 错误
- events 事件触发器
- fs 文件系统
- global 全局变量
- http 超文本传输协议
- http2 超文本传输协议 2.0
- https 安全超文本传输协议
- inspector 检查器
- Intl 国际化
- module 模块
- module/cjs CommonJS 模块
- module/esm ECMAScript 模块
- module/package 包模块
- module/typescript TS 模块
- net 网络
- os 操作系统
- path 路径
- perf_hooks 性能钩子
- permission 权限
- process 进程
- punycode 域名代码
- querystring 查询字符串
- readline 逐行读取
- repl 交互式解释器
- report 诊断报告
- sea 单个可执行应用程序
Node.js v24.13.0 文档
- Node.js v24.13.0
-
目录
- QUIC
quic.connect(address[, options])quic.listen(onsession,[options])- 类:
QuicEndpoint - 类:
QuicEndpoint.StatsendpointStats.createdAtendpointStats.destroyedAtendpointStats.bytesReceivedendpointStats.bytesSentendpointStats.packetsReceivedendpointStats.packetsSentendpointStats.serverSessionsendpointStats.clientSessionsendpointStats.serverBusyCountendpointStats.retryCountendpointStats.versionNegotiationCountendpointStats.statelessResetCountendpointStats.immediateCloseCount
- 类:
QuicSessionsession.close()session.closedsession.destroy([error])session.destroyedsession.endpointsession.onstreamsession.ondatagramsession.ondatagramstatussession.onpathvalidationsession.onsessionticketsession.onversionnegotiationsession.onhandshakesession.createBidirectionalStream([options])session.createUnidirectionalStream([options])session.pathsession.sendDatagram(datagram)session.statssession.updateKey()session[Symbol.asyncDispose]()
- 类:
QuicSession.StatssessionStats.createdAtsessionStats.closingAtsessionStats.handshakeCompletedAtsessionStats.handshakeConfirmedAtsessionStats.bytesReceivedsessionStats.bytesSentsessionStats.bidiInStreamCountsessionStats.bidiOutStreamCountsessionStats.uniInStreamCountsessionStats.uniOutStreamCountsessionStats.maxBytesInFlightssessionStats.bytesInFlightsessionStats.blockCountsessionStats.cwndsessionStats.latestRttsessionStats.minRttsessionStats.rttVarsessionStats.smoothedRttsessionStats.ssthreshsessionStats.datagramsReceivedsessionStats.datagramsSentsessionStats.datagramsAcknowledgedsessionStats.datagramsLost
- 类:
QuicStream - 类:
QuicStream.Stats - 类型
- 类型:
EndpointOptionsendpointOptions.addressendpointOptions.addressLRUSizeendpointOptions.ipv6OnlyendpointOptions.maxConnectionsPerHostendpointOptions.maxConnectionsTotalendpointOptions.maxRetriesendpointOptions.maxStatelessResetsPerHostendpointOptions.retryTokenExpirationendpointOptions.resetTokenSecretendpointOptions.tokenExpirationendpointOptions.tokenSecretendpointOptions.udpReceiveBufferSizeendpointOptions.udpSendBufferSizeendpointOptions.udpTTLendpointOptions.validateAddress
- 类型:
SessionOptionssessionOptions.alpnsessionOptions.casessionOptions.ccsessionOptions.certssessionOptions.cipherssessionOptions.crlsessionOptions.groupssessionOptions.keylogsessionOptions.keyssessionOptions.maxPayloadSizesessionOptions.maxStreamWindowsessionOptions.maxWindowsessionOptions.minVersionsessionOptions.preferredAddressPolicysessionOptions.qlogsessionOptions.sessionTicketsessionOptions.handshakeTimeoutsessionOptions.snisessionOptions.tlsTracesessionOptions.transportParamssessionOptions.unacknowledgedPacketThresholdsessionOptions.verifyClientsessionOptions.verifyPrivateKeysessionOptions.version
- 类型:
TransportParamstransportParams.preferredAddressIpv4transportParams.preferredAddressIpv6transportParams.initialMaxStreamDataBidiLocaltransportParams.initialMaxStreamDataBidiRemotetransportParams.initialMaxStreamDataUnitransportParams.initialMaxDatatransportParams.initialMaxStreamsBiditransportParams.initialMaxStreamsUnitransportParams.maxIdleTimeouttransportParams.activeConnectionIDLimittransportParams.ackDelayExponenttransportParams.maxAckDelaytransportParams.maxDatagramFrameSize
- 类型:
- 回调
- 诊断通道
- 通道:
quic.endpoint.created - 通道:
quic.endpoint.listen - 通道:
quic.endpoint.closing - 通道:
quic.endpoint.closed - 通道:
quic.endpoint.error - 通道:
quic.endpoint.busy.change - 通道:
quic.session.created.client - 通道:
quic.session.created.server - 通道:
quic.session.open.stream - 通道:
quic.session.received.stream - 通道:
quic.session.send.datagram - 通道:
quic.session.update.key - 通道:
quic.session.closing - 通道:
quic.session.closed - 通道:
quic.session.receive.datagram - 通道:
quic.session.receive.datagram.status - 通道:
quic.session.path.validation - 通道:
quic.session.ticket - 通道:
quic.session.version.negotiation - 通道:
quic.session.handshake
- 通道:
- QUIC
-
导航
- assert 断言
- async_hooks 异步钩子
- async_hooks/context 异步上下文
- buffer 缓冲区
- C++插件
- C/C++插件(使用 Node-API)
- C++嵌入器
- child_process 子进程
- cluster 集群
- CLI 命令行
- console 控制台
- crypto 加密
- crypto/webcrypto 网络加密
- debugger 调试器
- deprecation 弃用
- dgram 数据报
- diagnostics_channel 诊断通道
- dns 域名服务器
- domain 域
- Error 错误
- events 事件触发器
- fs 文件系统
- global 全局变量
- http 超文本传输协议
- http2 超文本传输协议 2.0
- https 安全超文本传输协议
- inspector 检查器
- Intl 国际化
- module 模块
- module/cjs CommonJS 模块
- module/esm ECMAScript 模块
- module/package 包模块
- module/typescript TS 模块
- net 网络
- os 操作系统
- path 路径
- perf_hooks 性能钩子
- permission 权限
- process 进程
- punycode 域名代码
- querystring 查询字符串
- readline 逐行读取
- repl 交互式解释器
- report 诊断报告
- sea 单个可执行应用程序
- 其他版本
QUIC#>
源代码: lib/quic.js
'node:quic' 模块提供了 QUIC 协议的实现。要访问它,请使用 --experimental-quic 选项启动 Node.js,并执行以下操作:
🌐 The 'node:quic' module provides an implementation of the QUIC protocol.
To access it, start Node.js with the --experimental-quic option and:
import quic from 'node:quic';const quic = require('node:quic');
该模块仅在 node: 方案下可用。
🌐 The module is only available under the node: scheme.
quic.connect(address[, options])#>
address<string> | <net.SocketAddress>optionsquic.SessionOptions- 返回:<Promise> 对 quic.QuicSession 的承诺
启动新的客户端会话。
🌐 Initiate a new client-side session.
import { connect } from 'node:quic';
import { Buffer } from 'node:buffer';
const enc = new TextEncoder();
const alpn = 'foo';
const client = await connect('123.123.123.123:8888', { alpn });
await client.createUnidirectionalStream({
body: enc.encode('hello world'),
});
默认情况下,每次调用 connect(...) 都会创建一个新的本地 QuicEndpoint 实例,并绑定到一个随机的本地 IP 端口。要指定使用的确切本地地址,或者在单个本地端口上复用多个 QUIC 会话,请传递 endpoint 选项,其参数可以是 QuicEndpoint 或 EndpointOptions。
🌐 By default, every call to connect(...) will create a new local
QuicEndpoint instance bound to a new random local IP port. To
specify the exact local address to use, or to multiplex multiple
QUIC sessions over a single local port, pass the endpoint option
with either a QuicEndpoint or EndpointOptions as the argument.
import { QuicEndpoint, connect } from 'node:quic';
const endpoint = new QuicEndpoint({
address: '127.0.0.1:1234',
});
const client = await connect('123.123.123.123:8888', { endpoint });
quic.listen(onsession,[options])#>
onsessionquic.OnSessionCallbackoptionsquic.SessionOptions- 返回:<Promise> 对 quic.QuicEndpoint 的承诺
将端点配置为作为服务器监听。当远程端启动新会话时,将调用所提供的 onsession 回调,并传入创建的会话。
🌐 Configures the endpoint to listen as a server. When a new session is initiated by
a remote peer, the given onsession callback will be invoked with the created
session.
import { listen } from 'node:quic';
const endpoint = await listen((session) => {
// ... handle the session
});
// Closing the endpoint allows any sessions open when close is called
// to complete naturally while preventing new sessions from being
// initiated. Once all existing sessions have finished, the endpoint
// will be destroyed. The call returns a promise that is resolved once
// the endpoint is destroyed.
await endpoint.close();
默认情况下,每次调用 listen(...) 都会创建一个新的本地 QuicEndpoint 实例,并绑定到一个随机的本地 IP 端口。要指定使用的确切本地地址,或在单个本地端口上复用多个 QUIC 会话,请传递 endpoint 选项,其参数可以是 QuicEndpoint 或 EndpointOptions。
🌐 By default, every call to listen(...) will create a new local
QuicEndpoint instance bound to a new random local IP port. To
specify the exact local address to use, or to multiplex multiple
QUIC sessions over a single local port, pass the endpoint option
with either a QuicEndpoint or EndpointOptions as the argument.
最多,任何单个 QuicEndpoint 只能被配置为以服务器身份监听一次。
🌐 At most, any single QuicEndpoint can only be configured to listen as
a server once.
类:QuicEndpoint#>
🌐 Class: QuicEndpoint
QuicEndpoint 封装了 QUIC 的本地 UDP 端口绑定。它可以同时用作客户端和服务器。
🌐 A QuicEndpoint encapsulates the local UDP-port binding for QUIC. It can be
used as both a client and a server.
new QuicEndpoint([options])#>
optionsquic.EndpointOptions
endpoint.address#>
端点绑定到的本地 UDP 套接字地址(如果有)。
🌐 The local UDP socket address to which the endpoint is bound, if any.
如果端点当前未绑定,则其值将为 undefined。只读。
🌐 If the endpoint is not currently bound then the value will be undefined. Read only.
endpoint.busy#>
- 类型:<boolean>
当 endpoint.busy 设置为 true 时,终端将暂时拒绝创建新的会话。可读/可写。
🌐 When endpoint.busy is set to true, the endpoint will temporarily reject
new sessions from being created. Read/write.
// Mark the endpoint busy. New sessions will be prevented.
endpoint.busy = true;
// Mark the endpoint free. New session will be allowed.
endpoint.busy = false;
busy 属性在终端负载很高且需要在赶上进度时暂时拒绝新会话时非常有用。
🌐 The busy property is useful when the endpoint is under heavy load and needs to
temporarily reject new sessions while it catches up.
endpoint.close()#>
- 返回:<Promise>
优雅地关闭端点。当所有当前打开的会话关闭后,端点将自动关闭并销毁。一旦调用,新的会话将被拒绝。
🌐 Gracefully close the endpoint. The endpoint will close and destroy itself when all currently open sessions close. Once called, new sessions will be rejected.
返回一个在端点被销毁时实现的 promise。
🌐 Returns a promise that is fulfilled when the endpoint is destroyed.
endpoint.closed#>
- 类型:<Promise>
当端点被销毁时会被 fulfillment 的承诺。这将与 endpoint.close() 函数返回的承诺相同。只读。
🌐 A promise that is fulfilled when the endpoint is destroyed. This will be the same promise that is
returned by the endpoint.close() function. Read only.
endpoint.closing#>
- 类型:<boolean>
如果已调用 endpoint.close() 且端点关闭尚未完成,则为 True。仅可读。
🌐 True if endpoint.close() has been called and closing the endpoint has not yet completed.
Read only.
endpoint.destroy([error])#>
error<any>
通过强制立即关闭所有打开的会话来强制关闭终端。
🌐 Forcefully closes the endpoint by forcing all open sessions to be immediately closed.
endpoint.destroyed#>
- 类型:<boolean>
如果 endpoint.destroy() 已被调用,则为真。只读。
🌐 True if endpoint.destroy() has been called. Read only.
endpoint.stats#>
- 类型:quic.QuicEndpoint.Stats
为活动会话收集的统计数据。只读。
🌐 The statistics collected for an active session. Read only.
endpoint[Symbol.asyncDispose]()#>
调用 endpoint.close() 并返回一个在端点关闭后完成的 Promise。
🌐 Calls endpoint.close() and returns a promise that fulfills when the
endpoint has closed.
类:QuicEndpoint.Stats#>
🌐 Class: QuicEndpoint.Stats
端点收集的统计信息的视图。
🌐 A view of the collected statistics for an endpoint.
endpointStats.createdAt#>
- 类型:<bigint> 一个指示端点创建时刻的时间戳。只读。
endpointStats.destroyedAt#>
- 类型:<bigint> 一个指示端点被销毁时刻的时间戳。仅可读。
endpointStats.bytesReceived#>
- 类型:<bigint> 此端点接收到的字节总数。只读。
endpointStats.bytesSent#>
- 类型:<bigint> 此端点发送的字节总数。只读。
endpointStats.packetsReceived#>
- 类型:<bigint> 此端点成功接收的 QUIC 数据包总数。只读。
endpointStats.packetsSent#>
- 类型:<bigint> 此端点成功发送的 QUIC 数据包总数。只读。
endpointStats.serverSessions#>
- 类型:<bigint> 该端点接收的对等端发起会话的总数。仅限读取。
endpointStats.clientSessions#>
- 类型:<bigint> 此端点启动的会话总数。仅可读取。
endpointStats.serverBusyCount#>
- 类型:<bigint> 由于端点被标记为忙而导致初始数据包被拒绝的总次数。只读。
endpointStats.retryCount#>
- 类型:<bigint> 此端点上的 QUIC 重试尝试总数。仅可读。
endpointStats.versionNegotiationCount#>
- 类型:<bigint> 由于 QUIC 版本不匹配而被拒绝的会话总数。只读。
endpointStats.statelessResetCount#>
- 类型:<bigint> 此端点处理的无状态重置总数。仅限读取。
endpointStats.immediateCloseCount#>
- 类型:<bigint> 握手结束前关闭的会话总数。仅限读取。
类:QuicSession#>
🌐 Class: QuicSession
QuicSession 表示 QUIC 连接的本地端。
🌐 A QuicSession represents the local side of a QUIC connection.
session.close()#>
- 返回:<Promise>
启动会话的优雅关闭。现有的流将被允许完成,但不会开启新的流。一旦所有流都已关闭,会话将被销毁。返回的承诺将在会话被销毁后兑现。
🌐 Initiate a graceful close of the session. Existing streams will be allowed to complete but no new streams will be opened. Once all streams have closed, the session will be destroyed. The returned promise will be fulfilled once the session has been destroyed.
session.closed#>
- 类型:<Promise>
会话销毁后实现的 promise。
🌐 A promise that is fulfilled once the session is destroyed.
session.destroy([error])#>
error<any>
立即销毁会话。所有流将被销毁,且会话将被关闭。
🌐 Immediately destroy the session. All streams will be destroys and the session will be closed.
session.destroyed#>
- 类型:<boolean>
如果 session.destroy() 已被调用,则为真。只读。
🌐 True if session.destroy() has been called. Read only.
session.endpoint#>
- 类型:quic.QuicEndpoint
创建此会话的端点。仅限读取。
🌐 The endpoint that created this session. Read only.
session.onstream#>
- 类型:quic.OnStreamCallback
当远程端启动新流时要调用的回调。可读/写。
🌐 The callback to invoke when a new stream is initiated by a remote peer. Read/write.
session.ondatagram#>
- 类型:quic.OnDatagramCallback
当从远程节点接收到新的数据报时要调用的回调。可读/可写。
🌐 The callback to invoke when a new datagram is received from a remote peer. Read/write.
session.ondatagramstatus#>
- 类型:quic.OnDatagramStatusCallback
当数据报的状态更新时要调用的回调。可读写。
🌐 The callback to invoke when the status of a datagram is updated. Read/write.
session.onpathvalidation#>
- 类型:quic.OnPathValidationCallback
路径验证更新时要调用的回调。可读写。
🌐 The callback to invoke when the path validation is updated. Read/write.
session.onsessionticket#>
- 类型:quic.OnSessionTicketCallback
在收到新会话票证时调用的回调。可读/可写。
🌐 The callback to invoke when a new session ticket is received. Read/write.
session.onversionnegotiation#>
- 类型:quic.OnVersionNegotiationCallback
当发起版本协商时要调用的回调函数。可读/可写。
🌐 The callback to invoke when a version negotiation is initiated. Read/write.
session.onhandshake#>
- 类型:quic.OnHandshakeCallback
TLS 握手完成时调用的回调。可读/可写。
🌐 The callback to invoke when the TLS handshake is completed. Read/write.
session.createBidirectionalStream([options])#>
options<Object>body<ArrayBuffer> | <ArrayBufferView> | <Blob>sendOrder<number>
- 返回:<Promise> 用于 quic.QuicStream
打开一个新的双向流。如果未指定 body 选项,发送方流将半关闭。
🌐 Open a new bidirectional stream. If the body option is not specified,
the outgoing stream will be half-closed.
session.createUnidirectionalStream([options])#>
options<Object>body<ArrayBuffer> | <ArrayBufferView> | <Blob>sendOrder<number>
- 返回:<Promise> 用于 quic.QuicStream
打开一个新的单向流。如果未指定 body 选项,输出流将被关闭。
🌐 Open a new unidirectional stream. If the body option is not specified,
the outgoing stream will be closed.
session.path#>
- 类型:<Object> | <undefined>
local<net.SocketAddress>remote<net.SocketAddress>
与会话关联的本地和远程套接字地址。只读。
🌐 The local and remote socket addresses associated with the session. Read only.
session.sendDatagram(datagram)#>
datagram<string> | <ArrayBufferView>- 返回:<bigint>
向远程端发送不可靠的数据报,并返回数据报 ID。如果数据报的有效载荷指定为 ArrayBufferView,则该视图的所有权将转移到底层流。
🌐 Sends an unreliable datagram to the remote peer, returning the datagram ID.
If the datagram payload is specified as an ArrayBufferView, then ownership of
that view will be transfered to the underlying stream.
session.stats#>
- 类型:quic.QuicSession.Stats
返回当前会话的统计数据。仅可读取。
🌐 Return the current statistics for the session. Read only.
session.updateKey()#>
启动会话的密钥更新。
🌐 Initiate a key update for the session.
session[Symbol.asyncDispose]()#>
调用 session.close() 并返回一个在会话关闭后完成的 Promise。
🌐 Calls session.close() and returns a promise that fulfills when the
session has closed.
类:QuicSession.Stats#>
🌐 Class: QuicSession.Stats
sessionStats.createdAt#>
- 类型:<bigint>
sessionStats.closingAt#>
- 类型:<bigint>
sessionStats.handshakeCompletedAt#>
- 类型:<bigint>
sessionStats.handshakeConfirmedAt#>
- 类型:<bigint>
sessionStats.bytesReceived#>
- 类型:<bigint>
sessionStats.bytesSent#>
- 类型:<bigint>
sessionStats.bidiInStreamCount#>
- 类型:<bigint>
sessionStats.bidiOutStreamCount#>
- 类型:<bigint>
sessionStats.uniInStreamCount#>
- 类型:<bigint>
sessionStats.uniOutStreamCount#>
- 类型:<bigint>
sessionStats.maxBytesInFlights#>
- 类型:<bigint>
sessionStats.bytesInFlight#>
- 类型:<bigint>
sessionStats.blockCount#>
- 类型:<bigint>
sessionStats.cwnd#>
- 类型:<bigint>
sessionStats.latestRtt#>
- 类型:<bigint>
sessionStats.minRtt#>
- 类型:<bigint>
sessionStats.rttVar#>
- 类型:<bigint>
sessionStats.smoothedRtt#>
- 类型:<bigint>
sessionStats.ssthresh#>
- 类型:<bigint>
sessionStats.datagramsReceived#>
- 类型:<bigint>
sessionStats.datagramsSent#>
- 类型:<bigint>
sessionStats.datagramsAcknowledged#>
- 类型:<bigint>
sessionStats.datagramsLost#>
- 类型:<bigint>
类:QuicStream#>
🌐 Class: QuicStream
stream.closed#>
- 类型:<Promise>
流完全关闭后实现的 promise。
🌐 A promise that is fulfilled when the stream is fully closed.
stream.destroy([error])#>
error<any>
立即突然销毁流。
🌐 Immediately and abruptly destroys the stream.
stream.destroyed#>
- 类型:<boolean>
如果已调用 stream.destroy(),则为真。
🌐 True if stream.destroy() has been called.
stream.direction#>
- 类型:<string>
'bidi'或'uni'中的一个。
流向。只读。
🌐 The directionality of the stream. Read only.
stream.id#>
- 类型:<bigint>
流ID。只读。
🌐 The stream ID. Read only.
stream.onblocked#>
- 类型:quic.OnBlockedCallback
当流被阻塞时要调用的回调。可读/可写。
🌐 The callback to invoke when the stream is blocked. Read/write.
stream.onreset#>
- 类型:quic.OnStreamErrorCallback
当流被重置时要调用的回调。可读/可写。
🌐 The callback to invoke when the stream is reset. Read/write.
stream.readable#>
stream.session#>
- 类型:quic.QuicSession
创建此流的会话。只读。
🌐 The session that created this stream. Read only.
stream.stats#>
- 类型:quic.QuicStream.Stats
当前流的数据统计。只读。
🌐 The current statistics for the stream. Read only.
类:QuicStream.Stats#>
🌐 Class: QuicStream.Stats
streamStats.ackedAt#>
- 类型:<bigint>
streamStats.bytesReceived#>
- 类型:<bigint>
streamStats.bytesSent#>
- 类型:<bigint>
streamStats.createdAt#>
- 类型:<bigint>
streamStats.destroyedAt#>
- 类型:<bigint>
streamStats.finalSize#>
- 类型:<bigint>
streamStats.isConnected#>
- 类型:<bigint>
streamStats.maxOffset#>
- 类型:<bigint>
streamStats.maxOffsetAcknowledged#>
- 类型:<bigint>
streamStats.maxOffsetReceived#>
- 类型:<bigint>
streamStats.openedAt#>
- 类型:<bigint>
streamStats.receivedAt#>
- 类型:<bigint>
类型#>
🌐 Types
类型:EndpointOptions#>
🌐 Type: EndpointOptions
- 类型:<Object>
在构建新的 QuicEndpoint 实例时传入的端点配置选项。
🌐 The endpoint configuration options passed when constructing a new QuicEndpoint instance.
endpointOptions.address#>
- 类型:<net.SocketAddress> | <string> 终端应绑定的本地 UDP 地址和端口。
如果未指定,端点将绑定到 IPv4 的 localhost,并使用随机端口。
🌐 If not specified the endpoint will bind to IPv4 localhost on a random port.
endpointOptions.addressLRUSize#>
该端点维护一个经过验证的套接字地址的内部缓存以优化性能。此选项设置缓存的地址的最大数量。这个是高级选项,用户通常不需要指定。
🌐 The endpoint maintains an internal cache of validated socket addresses as a performance optimization. This option sets the maximum number of addresses that are cache. This is an advanced option that users typically won't have need to specify.
endpointOptions.ipv6Only#>
- 类型:<boolean>
当为 true 时,表示该端点应仅绑定到 IPv6 地址。
🌐 When true, indicates that the endpoint should bind only to IPv6 addresses.
endpointOptions.maxConnectionsPerHost#>
指定每个远程对等地址允许的最大并发会话数。
🌐 Specifies the maximum number of concurrent sessions allowed per remote peer address.
endpointOptions.maxConnectionsTotal#>
指定最大并发会话总数。
🌐 Specifies the maximum total number of concurrent sessions.
endpointOptions.maxRetries#>
指定每个远程对等地址允许的最大 QUIC 重试次数。
🌐 Specifies the maximum number of QUIC retry attempts allowed per remote peer address.
endpointOptions.maxStatelessResetsPerHost#>
指定每个远程对等地址允许的最大无状态重置次数。
🌐 Specifies the maximum number of stateless resets that are allowed per remote peer address.
endpointOptions.retryTokenExpiration#>
指定 QUIC 重试令牌被视为有效的时间长度。
🌐 Specifies the length of time a QUIC retry token is considered valid.
endpointOptions.resetTokenSecret#>
指定用于生成 QUIC 重试令牌的 16 字节密钥。
🌐 Specifies the 16-byte secret used to generate QUIC retry tokens.
endpointOptions.tokenExpiration#>
指定 QUIC 令牌被视为有效的时间长度。
🌐 Specifies the length of time a QUIC token is considered valid.
endpointOptions.tokenSecret#>
指定用于生成 QUIC 令牌的 16 字节密钥。
🌐 Specifies the 16-byte secret used to generate QUIC tokens.
endpointOptions.udpReceiveBufferSize#>
- 类型:<number>
endpointOptions.udpSendBufferSize#>
- 类型:<number>
endpointOptions.udpTTL#>
- 类型:<number>
endpointOptions.validateAddress#>
- 类型:<boolean>
当为true时,要求端点在建立新连接时使用重试数据包来验证对等方地址。
🌐 When true, requires that the endpoint validate peer addresses using retry packets
while establishing a new connection.
类型:SessionOptions#>
🌐 Type: SessionOptions
sessionOptions.alpn#>
- 类型:<string>
ALPN 协议标识符。
🌐 The ALPN protocol identifier.
sessionOptions.ca#>
用于会话的 CA 证书。
🌐 The CA certificates to use for sessions.
sessionOptions.cc#>
- 类型:<string>
指定将使用的拥塞控制算法。必须设置为 'reno'、'cubic' 或 'bbr' 中的一个。
🌐 Specifies the congestion control algorithm that will be used
. Must be set to one of either 'reno', 'cubic', or 'bbr'.
这是一个高级选项,用户通常不需要指定。
🌐 This is an advanced option that users typically won't have need to specify.
sessionOptions.certs#>
用于会话的 TLS 证书。
🌐 The TLS certificates to use for sessions.
sessionOptions.ciphers#>
- 类型:<string>
支持的 TLS 1.3 密码算法列表。
🌐 The list of supported TLS 1.3 cipher algorithms.
sessionOptions.crl#>
用于会话的 CRL。
🌐 The CRL to use for sessions.
sessionOptions.groups#>
- 类型:<string>
支持 TLS 1.3 密码组的列表。
🌐 The list of support TLS 1.3 cipher groups.
sessionOptions.keylog#>
- 类型:<boolean>
如果启用 TLS 键盘记录输出,则为 True。
🌐 True to enable TLS keylogging output.
sessionOptions.keys#>
- 类型:<KeyObject> | <CryptoKey> | <KeyObject[]> | <CryptoKey[]>
用于会话的 TLS 加密密钥。
🌐 The TLS crypto keys to use for sessions.
sessionOptions.maxPayloadSize#>
指定最大 UDP 数据包有效负载大小。
🌐 Specifies the maximum UDP packet payload size.
sessionOptions.maxStreamWindow#>
指定最大流流量控制窗口大小。
🌐 Specifies the maximum stream flow-control window size.
sessionOptions.maxWindow#>
指定会话流控制窗口的最大大小。
🌐 Specifies the maximum session flow-control window size.
sessionOptions.minVersion#>
- 类型:<number>
允许的最低 QUIC 版本号。这是一个高级选项,普通用户通常不需要指定。
🌐 The minimum QUIC version number to allow. This is an advanced option that users typically won't have need to specify.
sessionOptions.preferredAddressPolicy#>
- 类型:<string>
'use'、'ignore'或'default'之一。
当远程端广告首选地址时,此选项指定是使用它还是忽略它。
🌐 When the remote peer advertises a preferred address, this option specifies whether to use it or ignore it.
sessionOptions.qlog#>
- 类型:<boolean>
如果应启用 qlog 输出,则为 True。
🌐 True if qlog output should be enabled.
sessionOptions.sessionTicket#>
- 类型:<ArrayBufferView> 用于 0RTT 会话恢复的会话票据。
sessionOptions.handshakeTimeout#>
指定 TLS 握手允许完成的最长毫秒数,超过此时间将超时。
🌐 Specifies the maximum number of milliseconds a TLS handshake is permitted to take to complete before timing out.
sessionOptions.sni#>
- 类型:<string>
目标对等服务器名称。
🌐 The peer server name to target.
sessionOptions.tlsTrace#>
- 类型:<boolean>
如果启用 TLS 跟踪输出,则为 True。
🌐 True to enable TLS tracing output.
sessionOptions.transportParams#>
- 类型:quic.TransportParams
用于会话的 QUIC 传输参数。
🌐 The QUIC transport parameters to use for the session.
sessionOptions.unacknowledgedPacketThreshold#>
指定会话应允许的最大未确认数据包数。
🌐 Specifies the maximum number of unacknowledged packets a session should allow.
sessionOptions.verifyClient#>
- 类型:<boolean>
如果要求验证 TLS 客户端证书,则为 True。
🌐 True to require verification of TLS client certificate.
sessionOptions.verifyPrivateKey#>
- 类型:<boolean>
如果要求私钥验证,则为 True。
🌐 True to require private key verification.
sessionOptions.version#>
- 类型:<number>
要使用的 QUIC 版本号。这是一个高级选项,普通用户通常不需要指定。
🌐 The QUIC version number to use. This is an advanced option that users typically won't have need to specify.
类型:TransportParams#>
🌐 Type: TransportParams
transportParams.preferredAddressIpv4#>
- 类型:<net.SocketAddress> 首选用于发布的 IPv4 地址。
transportParams.preferredAddressIpv6#>
- 类型:<net.SocketAddress> 首选用于发布的 IPv6 地址。
transportParams.initialMaxStreamDataBidiLocal#>
transportParams.initialMaxStreamDataBidiRemote#>
transportParams.initialMaxStreamDataUni#>
transportParams.initialMaxData#>
transportParams.initialMaxStreamsBidi#>
transportParams.initialMaxStreamsUni#>
transportParams.maxIdleTimeout#>
transportParams.activeConnectionIDLimit#>
transportParams.ackDelayExponent#>
transportParams.maxAckDelay#>
transportParams.maxDatagramFrameSize#>
回调#>
🌐 Callbacks
回调:OnSessionCallback#>
🌐 Callback: OnSessionCallback
thisquic.QuicEndpointsessionquic.QuicSession
当远程对等方发起新会话时调用的回调函数。
🌐 The callback function that is invoked when a new session is initiated by a remote peer.
回调:OnStreamCallback#>
🌐 Callback: OnStreamCallback
thisquic.QuicSessionstreamquic.QuicStream
回调:OnDatagramCallback#>
🌐 Callback: OnDatagramCallback
thisquic.QuicSessiondatagram<Uint8Array>early<boolean>
回调:OnDatagramStatusCallback#>
🌐 Callback: OnDatagramStatusCallback
回调:OnPathValidationCallback#>
🌐 Callback: OnPathValidationCallback
thisquic.QuicSessionresult<string> 以下三个之一:'success'、'failure'或'aborted'。newLocalAddress<net.SocketAddress>newRemoteAddress<net.SocketAddress>oldLocalAddress<net.SocketAddress>oldRemoteAddress<net.SocketAddress>preferredAddress<boolean>
回调:OnSessionTicketCallback#>
🌐 Callback: OnSessionTicketCallback
thisquic.QuicSessionticket<Object>
回调:OnVersionNegotiationCallback#>
🌐 Callback: OnVersionNegotiationCallback
thisquic.QuicSessionversion<number>requestedVersions<number[]>supportedVersions<number[]>
回调:OnHandshakeCallback#>
🌐 Callback: OnHandshakeCallback
thisquic.QuicSessionsni<string>alpn<string>cipher<string>cipherVersion<string>validationErrorReason<string>validationErrorCode<number>earlyDataAccepted<boolean>
回调:OnBlockedCallback#>
🌐 Callback: OnBlockedCallback
thisquic.QuicStream
回调:OnStreamErrorCallback#>
🌐 Callback: OnStreamErrorCallback
thisquic.QuicStreamerror<any>
诊断通道#>
🌐 Diagnostic Channels
通道:quic.endpoint.created#>
🌐 Channel: quic.endpoint.created
endpointquic.QuicEndpointconfigquic.EndpointOptions
通道:quic.endpoint.listen#>
🌐 Channel: quic.endpoint.listen
endpointquic.QuicEndpointoptoinsquic.SessionOptions
通道:quic.endpoint.closing#>
🌐 Channel: quic.endpoint.closing
endpointquic.QuicEndpointhasPendingError<boolean>
通道:quic.endpoint.closed#>
🌐 Channel: quic.endpoint.closed
endpointquic.QuicEndpoint
通道:quic.endpoint.error#>
🌐 Channel: quic.endpoint.error
endpointquic.QuicEndpointerror<any>
通道:quic.endpoint.busy.change#>
🌐 Channel: quic.endpoint.busy.change
endpointquic.QuicEndpointbusy<boolean>
通道:quic.session.created.client#>
🌐 Channel: quic.session.created.client
通道:quic.session.created.server#>
🌐 Channel: quic.session.created.server
通道:quic.session.open.stream#>
🌐 Channel: quic.session.open.stream
通道:quic.session.received.stream#>
🌐 Channel: quic.session.received.stream
通道:quic.session.send.datagram#>
🌐 Channel: quic.session.send.datagram
通道:quic.session.update.key#>
🌐 Channel: quic.session.update.key
通道:quic.session.closing#>
🌐 Channel: quic.session.closing
通道:quic.session.closed#>
🌐 Channel: quic.session.closed
通道:quic.session.receive.datagram#>
🌐 Channel: quic.session.receive.datagram
通道:quic.session.receive.datagram.status#>
🌐 Channel: quic.session.receive.datagram.status
通道:quic.session.path.validation#>
🌐 Channel: quic.session.path.validation
通道:quic.session.ticket#>
🌐 Channel: quic.session.ticket
通道:quic.session.version.negotiation#>
🌐 Channel: quic.session.version.negotiation
通道:quic.session.handshake#>
🌐 Channel: quic.session.handshake