Skip to content

兼容 Shadowsocks simple-obfs 订阅插件别名#48

Merged
Resinat merged 1 commit into
Resinat:masterfrom
icellus:fix/simple-obfs-plugin-aliases
May 5, 2026
Merged

兼容 Shadowsocks simple-obfs 订阅插件别名#48
Resinat merged 1 commit into
Resinat:masterfrom
icellus:fix/simple-obfs-plugin-aliases

Conversation

@icellus

@icellus icellus commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

背景

部分 Shadowsocks 订阅会使用 plugin: obfsplugin: simple-obfs 表达 simple-obfs 节点,并通过 mode / host 表达插件参数。

但 sing-box 当前支持的 SIP003 插件名是 obfs-local,如果 Resin 直接把订阅里的 obfs / simple-obfs 透传到出站配置,会导致节点运行时报错:

plugin not found: obfs

改动

  • 将 Shadowsocks 插件别名统一归一化:
    • obfs -> obfs-local
    • simple-obfs -> obfs-local
    • obfs-local 保持为 obfs-local
  • 将常见 simple-obfs 参数转换为 sing-box 可识别格式:
    • mode / obfs -> obfs
    • host / obfs-host / obfs_host -> obfs-host
  • 覆盖 SS URI、Clash JSON/YAML、SSD URI、Netch URI。
  • 保留未知额外插件参数。
  • 保留 SIP003 plugin_opts 中转义的分号和等号,避免误切分 \;\=

测试补充

本 PR 同步补充了订阅解析测试用例,覆盖 simple-obfs 别名、分离参数格式、Clash/SSD/Netch 导入,以及 SIP003 转义参数边界。现有 v2ray-plugin 测试继续覆盖,确认非 simple-obfs 插件不会被误改写。

验证

已执行:

go test ./internal/subscription -count=1
go test ./...
git diff --check

关联问题

关联 #46。本次修复认为其中一类 Shadowsocks 节点熔断问题来自 simple-obfs 订阅格式兼容:订阅侧常见的 obfs / simple-obfsmode / host 没有转换成 sing-box 需要的 obfs-localobfs / obfs-host

其他 Shadowsocks 失败场景后续可以按具体节点格式和运行错误继续排查。

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.

2 participants