修复 TUIC 非法必填配置未在注册阶段拒绝#42
Draft
MiChongs wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
在对完整协议与传输层实现执行全量回归时,现有 TUIC 注册测试暴露出一个确定问题:当 UUID、密码或 UDP 中继模式等必填配置非法时,
tuic_from_node返回的错误会被build_tuic转换成一个占位出站对象。这样build_outbound仍返回成功,配置错误不会在注册阶段被拒绝,既与现有测试契约不符,也可能让错误延迟到实际连接阶段。修改内容
build_tuic的返回类型改为Result<SharedOutbound, String>。tuic_from_node产生的精确错误标签,并转换为注册层使用的字符串错误。?传播 TUIC 配置错误。行为变化
以下非法配置现在会在出站注册阶段立即失败,而不会生成占位对象:
udp-relay-mode。错误标签继续保持现有契约,例如
tuic(invalid-uuid)、tuic(missing-password)与tuic(invalid-udp-relay-mode)。验证
cargo test -p core-outbound registry::tests::tuic_registry_rejects_invalid_required_options --libcargo test -p core-outbound --libcore-outbound全量 354 个测试全部通过。cargo fmt --all -- --checkgit diff --check分支关系
本 PR 基于
codex/protocol-xhttp-full,相对该基线仅包含 1 个 TUIC 校验修复提交。FinalMask 完整实现将作为后续独立分支叠加,避免把两个协议实现混在同一个提交中。