Skip to content

fix: xhttp 传输与 Fragment 分片不兼容 + 支持传输方式切换#1

Merged
wangzhizhou merged 1 commit into
mainfrom
fix/xhttp-fragment-incompatibility
Jun 18, 2026
Merged

fix: xhttp 传输与 Fragment 分片不兼容 + 支持传输方式切换#1
wangzhizhou merged 1 commit into
mainfrom
fix/xhttp-fragment-incompatibility

Conversation

@wangzhizhou

Copy link
Copy Markdown
Contributor

问题

xhttp (HTTP/3) 传输与 Fragment 包分片同时启用时,Reality 能连接但无法上网。fragmentSettings 是 TCP 层功能,与 xhttp 的 HTTP/2 流管理冲突。

详见计划文件: /Users/joker/.claude/plans/cozy-weaving-kernighan.md

修改

deploy.sh

  • 提取 write_xray_config_template() 函数消除模板代码重复
  • fragment 注入仅对 TCP 传输生效(3 处守卫 + 日志判断)
  • 已有配置路径检测 transport 变化并重新生成模板(保留 UUID/keys)

测试

  • test_config_generation.bats: 新增 3 个测试 + 增强现有断言
  • test_protocol_metadata.bats: 新增 xhttp export 测试

文档

  • .env.example: 修正示例配置(默认 TCP+Fragment,xhttp 为备选)
  • docs/deployment.md: 变量说明 + 不兼容警告

验证

  • ShellCheck: clean
  • xray 配置生成测试: 5/5 通过
  • 协议元数据测试: 33/33 通过(含 xhttp export)
  • 全量测试 268 项: 267 通过(1 个预存 GitHub URL 探活失败,无关)

Root cause: fragmentSettings 是 TCP 层功能,与 xhttp (HTTP/3) 传输冲突。
同时启用时连接可建立但数据传输出错。

Changes:
- deploy.sh: 提取 write_xray_config_template() 函数消除模板重复
- deploy.sh: fragment 注入仅对 tcp 生效(3 处守卫 + 日志判断)
- deploy.sh: 已有配置路径检测 transport 变化并重新生成模板(保留 key)
- tests: 新增 4 个测试覆盖 xhttp/fragment/切换场景
- .env.example: 修正示例配置(默认 TCP+Fragment,xhttp 为备选)
- docs/deployment.md: 增加不兼容警告说明
@wangzhizhou wangzhizhou merged commit 5086f2a into main Jun 18, 2026
4 checks passed
@wangzhizhou wangzhizhou deleted the fix/xhttp-fragment-incompatibility branch June 18, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant