Skip to content

缺陷: VLESS + XHTTP 节点反向转换丢失 xhttp-opts 的 path/host/mode #455

Description

@zhaxg

现象

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):

  1. functions/utils/clash-to-url.js — vless 分支只处理 ws-opts / grpc-opts / httpupgrade-opts,无 xhttp-opts
  2. src/utils/protocols/converters/vless.jsconvertVlessToUrl 的 switch 无 case 'xhttp'

而正向 functions/utils/url-to-clash.js 已完整支持 xhttp(含 x-padding-* extra 映射),反向不对称导致数据丢失。

影响场景

  • 导入 Clash YAML 订阅 → extractValidNodesconvertClashProxyToUrl
  • Surge / Quantumult X 文本行解析
  • 前端手动节点 / 预览 roundtrip(protocolConverter)

xhttp 节点经 "Clash 形态 → URL" 一跳后 path 丢失,再输出 Clash/Xray 配置时节点连不上。

修复(已就绪)

fork 分支 zhaxg/misubstorefix/xhttp-opts-vless-roundtrip(commit 56134ab),两侧对称补齐:

  • functions/utils/clash-to-url.js: vless 分支新增 xhttpOptspath / host / mode,host 兼容 xhttpOpts.hostheaders.Host 两种写法
  • src/utils/protocols/converters/vless.js: switch 新增 case 'xhttp'

测试: tests/unit/node-utils.test.js(服务端 roundtrip)、tests/unit/protocolConverter.test.js(前端),roundtrip 已验证无损。

遗留

xhttp-optsx-padding-* 字段未回写 URL 的 extra JSON(正向会读,反向暂未还原),不影响连通,建议后续补。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions