现象
VLESS + XHTTP 节点在 Clash proxy → vless:// URL 反向转换时,xhttp-opts 里的 path / host / mode 全部丢失,只剩 type=xhttp。正向(URL → Clash)不受影响。
复现
{
type: 'vless', server: 'host', port: 443, uuid: 'u',
network: 'xhttp',
'xhttp-opts': { path: '/argo', host: 'example.org', mode: 'packet-up' },
tls: true
}
输出:
vless://u@host:443?encryption=none&type=xhttp&security=tls # 缺 path/host/mode
预期 path=%2Fargo&host=example.org&mode=packet-up 出现在 URL 中。
根因
Clash → URL 方向两处转换器缺 xhttp 分支(仅覆盖 ws/grpc/httpupgrade/splithttp):
functions/utils/clash-to-url.js — vless 分支只处理 ws-opts / grpc-opts / httpupgrade-opts,无 xhttp-opts
src/utils/protocols/converters/vless.js — convertVlessToUrl 的 switch 无 case 'xhttp'
而正向 functions/utils/url-to-clash.js 已完整支持 xhttp(含 x-padding-* extra 映射),反向不对称导致数据丢失。
影响场景
- 导入 Clash YAML 订阅 →
extractValidNodes → convertClashProxyToUrl
- Surge / Quantumult X 文本行解析
- 前端手动节点 / 预览 roundtrip(
protocolConverter)
xhttp 节点经 "Clash 形态 → URL" 一跳后 path 丢失,再输出 Clash/Xray 配置时节点连不上。
修复(已就绪)
fork 分支 zhaxg/misubstore 的 fix/xhttp-opts-vless-roundtrip(commit 56134ab),两侧对称补齐:
functions/utils/clash-to-url.js: vless 分支新增 xhttpOpts → path / host / mode,host 兼容 xhttpOpts.host 与 headers.Host 两种写法
src/utils/protocols/converters/vless.js: switch 新增 case 'xhttp'
测试: tests/unit/node-utils.test.js(服务端 roundtrip)、tests/unit/protocolConverter.test.js(前端),roundtrip 已验证无损。
遗留
xhttp-opts 中 x-padding-* 字段未回写 URL 的 extra JSON(正向会读,反向暂未还原),不影响连通,建议后续补。
现象
VLESS + XHTTP 节点在 Clash proxy → vless:// URL 反向转换时,
xhttp-opts里的path/host/mode全部丢失,只剩type=xhttp。正向(URL → Clash)不受影响。复现
输出:
预期
path=%2Fargo&host=example.org&mode=packet-up出现在 URL 中。根因
Clash → URL 方向两处转换器缺
xhttp分支(仅覆盖 ws/grpc/httpupgrade/splithttp):functions/utils/clash-to-url.js— vless 分支只处理ws-opts/grpc-opts/httpupgrade-opts,无xhttp-optssrc/utils/protocols/converters/vless.js—convertVlessToUrl的 switch 无case 'xhttp'而正向
functions/utils/url-to-clash.js已完整支持 xhttp(含x-padding-*extra 映射),反向不对称导致数据丢失。影响场景
extractValidNodes→convertClashProxyToUrlprotocolConverter)xhttp 节点经 "Clash 形态 → URL" 一跳后 path 丢失,再输出 Clash/Xray 配置时节点连不上。
修复(已就绪)
fork 分支
zhaxg/misubstore的fix/xhttp-opts-vless-roundtrip(commit56134ab),两侧对称补齐:functions/utils/clash-to-url.js: vless 分支新增xhttpOpts→path/host/mode,host 兼容xhttpOpts.host与headers.Host两种写法src/utils/protocols/converters/vless.js: switch 新增case 'xhttp'测试:
tests/unit/node-utils.test.js(服务端 roundtrip)、tests/unit/protocolConverter.test.js(前端),roundtrip 已验证无损。遗留
xhttp-opts中x-padding-*字段未回写 URL 的extraJSON(正向会读,反向暂未还原),不影响连通,建议后续补。