Skip to content

Commit 4160f8b

Browse files
committed
fix(protocol): 修复 SS 和 Clash 协议间插件名称映射问题
- 在 Clash 协议中将 SS 链接的 "simple-obfs"/"obfs-local" 映射为 "obfs" - 在 SS 协议中将 Clash 的 "obfs" 映射回 "simple-obfs" - 确保协议转换时插件名称的正确对应关系 close: #84
1 parent d1181f5 commit 4160f8b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

node/protocol/clash.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,12 @@ func LinkToProxy(link Urls, config OutputConfig) (Proxy, error) {
216216
}
217217
// 处理 SS 插件
218218
if ss.Plugin.Name != "" {
219-
proxy.Plugin = ss.Plugin.Name
219+
// 插件名称映射:SS 链接中的 "simple-obfs"/"obfs-local" 在 Clash 中应该是 "obfs"
220+
pluginName := ss.Plugin.Name
221+
if pluginName == "simple-obfs" || pluginName == "obfs-local" {
222+
pluginName = "obfs"
223+
}
224+
proxy.Plugin = pluginName
220225
proxy.Plugin_opts = convertSSPluginOpts(ss.Plugin)
221226
}
222227

node/protocol/ss.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,13 @@ func ConvertProxyToSs(proxy Proxy) Ss {
343343

344344
// 处理插件信息
345345
if proxy.Plugin != "" {
346+
// 插件名称映射:Clash 中的 "obfs" 在 SS 链接中应该是 "simple-obfs"
347+
pluginName := proxy.Plugin
348+
if pluginName == "obfs" {
349+
pluginName = "simple-obfs"
350+
}
346351
ss.Plugin = SsPlugin{
347-
Name: proxy.Plugin,
352+
Name: pluginName,
348353
}
349354
if proxy.Plugin_opts != nil {
350355
if mode, ok := proxy.Plugin_opts["mode"].(string); ok {

0 commit comments

Comments
 (0)