quic: expose an API for client connection migration
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
What is the problem this feature will solve?
The current experimental node:quic API does not expose a way for a client to
intentionally move an established QuicSession to another local
QuicEndpoint. This is useful when an application wants to move a connection
between network interfaces or local UDP ports while preserving the existing
QUIC session, streams, and datagram flows.
Reconnecting is not equivalent because it discards the existing session state
and requires another handshake. Passive NAT rebinding also does not let an
application explicitly select a new local socket or interface.
RFC 9000 defines client-initiated connection migration. The
current API already exposes QuicEndpoint, session.path, and
session.onpathvalidation, and the bundled ngtcp2 implementation provides
ngtcp2_conn_initiate_migration(). The earlier experimental
Node.js QUIC API also exposed
QuicClientSession.migrate(quicSocket).
Would the QUIC team be interested in exposing this capability in the current
API?
What is the feature you are proposing to solve the problem?
One possible high-level API would be:
await session.migrate(endpoint);
The proposed behavior would be:
- It is available only for client sessions after the handshake is confirmed.
- An unbound target endpoint is bound before path validation begins.
- It rejects if the peer advertised
disable_active_migrationor if validation
of the new path fails. - It resolves after the new path has been validated and selected as the active
path. - Existing streams and datagram flows remain attached to the same session, and
session.pathreflects the new active path.
There are two related API questions where feedback would be useful:
- Should Node.js expose one high-level
migrate(endpoint)operation, or a
lower-level path abstraction that separates probing from switching? - Should server transport parameters expose a
disableActiveMigrationoption
for deployments that cannot preserve connection routing when a client's
address changes?
I have explored a proof of concept in manNomi/node#5, but I would
like to agree on the public API shape before opening an upstream pull request.
What alternatives have you considered?
One alternative is to expose a path-oriented API similar to quic-go:
const path = session.addPath(endpoint);
await path.probe();
path.switch();
path.close();
This gives applications control over when a candidate path is validated and
when it becomes active, but adds another public abstraction and more lifecycle
management.
Applications can instead create a new QUIC session or rely on OS routing and
passive NAT rebinding. Neither option provides explicit migration to a chosen
local endpoint while preserving the existing session and its streams.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先查看 RFC 9000 中关于连接迁移的章节、所链接的 ngtcp2 头文件中的 ngtcp2_conn_initiate_migration() 声明,以及早期的 Node.js QuicClientSession.migrate() API。将这些内容与 manNomi/node#5 中链接的原型进行比较;当 Node.js 公共 API 的形态和迁移行为达成一致并完成规范说明时,这项工作就完成了。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js
- 领域
- api, networking
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100