From 963db90f4ce766f1f39ba1fdb6956d1aba368d89 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Thu, 20 Nov 2025 14:18:13 +0800 Subject: [PATCH] stricter plugin name fix for SIP002 URI --- v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs index 769d7182..4229befe 100644 --- a/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/ShadowsocksFmt.cs @@ -177,20 +177,27 @@ public class ShadowsocksFmt : BaseFmt { var pluginStr = queryParameters["plugin"]; var pluginParts = pluginStr.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); - + if (pluginParts.Length == 0) { return null; } var pluginName = pluginParts[0]; - + + // A typo in https://github.com/shadowsocks/shadowsocks-org/blob/6b1c064db4129de99c516294960e731934841c94/docs/doc/sip002.md?plain=1#L15 + // "simple-obfs" should be "obfs-local" + if (pluginName == "simple-obfs") + { + pluginName = "obfs-local"; + } + // Parse obfs-local plugin if (pluginName == "obfs-local") { var obfsMode = pluginParts.FirstOrDefault(t => t.StartsWith("obfs=")); var obfsHost = pluginParts.FirstOrDefault(t => t.StartsWith("obfs-host=")); - + if ((!obfsMode.IsNullOrEmpty()) && obfsMode.Contains("obfs=http") && obfsHost.IsNotEmpty()) { obfsHost = obfsHost.Replace("obfs-host=", ""); @@ -229,7 +236,7 @@ public class ShadowsocksFmt : BaseFmt if (hasTls) { item.StreamSecurity = Global.StreamSecurity; - + if (!certRaw.IsNullOrEmpty()) { var certBase64 = certRaw.Replace("certRaw=", "");