fix(protocol): preserve VLESS HTTP upgrade URI options#263
Merged
Conversation
Encode HTTP Upgrade and fast-open flags into VLESS URIs so Mihomo configurations survive round-trip conversion. Extend the VLESS encode/decode regression test to cover both options. Fixes ZeroDeng01#262
There was a problem hiding this comment.
Pull request overview
This pull request fixes VLESS URI encoding so that Mihomo nodes retain the v2ray-http-upgrade and v2ray-http-upgrade-fast-open transport semantics after a “config → URI → config” roundtrip, preventing unintended downgrade back to plain WebSocket.
Changes:
- Update
EncodeVLESSURLto emithttpUpgrade=1whenQuery.HttpUpgrade == 1. - Update
EncodeVLESSURLto emithttpUpgradeFastOpen=1whenQuery.HttpUpgradeFastOpen == 1. - Extend the VLESS encode/decode roundtrip test to assert both fields are preserved.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| node/protocol/vless.go | Adds encoding of httpUpgrade and httpUpgradeFastOpen query parameters when enabled to preserve HTTP Upgrade transport options. |
| node/protocol/vless_test.go | Extends the roundtrip test to cover HttpUpgrade and HttpUpgradeFastOpen so regressions are caught. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
描述
修复 VLESS URI 编码未保留 HTTP Upgrade 扩展的问题,确保 Mihomo 节点经过“配置 → URI → 配置”往返转换后仍使用原有传输方式。
关联 Issue
Fixes #262
更改类型
更改内容
HttpUpgrade启用时,在 VLESS URI 中写入httpUpgrade=1HttpUpgradeFastOpen启用时,在 VLESS URI 中写入httpUpgradeFastOpen=1截图
不适用。
检查清单
我的代码遵循项目代码风格
后端检查已通过
前端改动已运行
yarn run lintUI 改动已检查 light/dark 和响应式状态
已按需补充或更新后端测试、注释和文档
行为或契约变化时,已检查跨层同步
本次更改不会引入安全漏洞
已运行命令或检查:
本地全量测试的
api失败与本改动无关:部分测试将 Windowst.TempDir()返回的反斜杠路径直接拼入 JSON,随后返回“配置读取错误”。PR 的 Linux GitHub Actions 将继续执行仓库规定的完整go test ./...。其他说明
这是编码器层面的最小修复。URI 解码、Mihomo 导入和 Mihomo 输出路径已经支持这两个字段,无需修改 API、前端、配置或文档。