mirror of
https://github.com/2dust/v2rayN.git
synced 2025-11-29 03:02:53 +00:00
Fix
This commit is contained in:
parent
963db90f4c
commit
8fd88ffe67
2 changed files with 18 additions and 1 deletions
|
|
@ -77,6 +77,10 @@ public class ShadowsocksFmt : BaseFmt
|
||||||
var endIndex = cert.IndexOf(endMarker, base64Start, StringComparison.Ordinal);
|
var endIndex = cert.IndexOf(endMarker, base64Start, StringComparison.Ordinal);
|
||||||
var base64Content = cert.Substring(base64Start, endIndex - base64Start);
|
var base64Content = cert.Substring(base64Start, endIndex - base64Start);
|
||||||
|
|
||||||
|
// https://github.com/shadowsocks/v2ray-plugin/blob/e9af1cdd2549d528deb20a4ab8d61c5fbe51f306/args.go#L172
|
||||||
|
// Equal signs and commas [and backslashes] must be escaped with a backslash.
|
||||||
|
base64Content = base64Content.Replace("\\", "\\\\").Replace("=", "\\=").Replace(",", "\\,");
|
||||||
|
|
||||||
pluginArgs += $"certRaw={base64Content};";
|
pluginArgs += $"certRaw={base64Content};";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +93,13 @@ public class ShadowsocksFmt : BaseFmt
|
||||||
var dicQuery = new Dictionary<string, string>();
|
var dicQuery = new Dictionary<string, string>();
|
||||||
if (plugin.IsNotEmpty())
|
if (plugin.IsNotEmpty())
|
||||||
{
|
{
|
||||||
dicQuery["plugin"] = plugin + (pluginArgs.IsNotEmpty() ? (";" + pluginArgs) : "");
|
var pluginStr = plugin + ";" + pluginArgs;
|
||||||
|
// pluginStr remove last ';' and url encode
|
||||||
|
if (pluginStr.EndsWith(';'))
|
||||||
|
{
|
||||||
|
pluginStr = pluginStr[..^1];
|
||||||
|
}
|
||||||
|
dicQuery["plugin"] = Utils.UrlEncode(pluginStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ToUri(EConfigType.Shadowsocks, item.Address, item.Port, pw, dicQuery, remark);
|
return ToUri(EConfigType.Shadowsocks, item.Address, item.Port, pw, dicQuery, remark);
|
||||||
|
|
@ -240,6 +250,9 @@ public class ShadowsocksFmt : BaseFmt
|
||||||
if (!certRaw.IsNullOrEmpty())
|
if (!certRaw.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
var certBase64 = certRaw.Replace("certRaw=", "");
|
var certBase64 = certRaw.Replace("certRaw=", "");
|
||||||
|
|
||||||
|
certBase64 = certBase64.Replace("\\=", "=").Replace("\\,", ",").Replace("\\\\", "\\");
|
||||||
|
|
||||||
const string beginMarker = "-----BEGIN CERTIFICATE-----\n";
|
const string beginMarker = "-----BEGIN CERTIFICATE-----\n";
|
||||||
const string endMarker = "\n-----END CERTIFICATE-----";
|
const string endMarker = "\n-----END CERTIFICATE-----";
|
||||||
var certPem = beginMarker + certBase64 + endMarker;
|
var certPem = beginMarker + certBase64 + endMarker;
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,10 @@ public partial class CoreConfigSingboxService
|
||||||
var endIndex = cert.IndexOf(endMarker, base64Start, StringComparison.Ordinal);
|
var endIndex = cert.IndexOf(endMarker, base64Start, StringComparison.Ordinal);
|
||||||
var base64Content = cert.Substring(base64Start, endIndex - base64Start);
|
var base64Content = cert.Substring(base64Start, endIndex - base64Start);
|
||||||
|
|
||||||
|
// https://github.com/shadowsocks/v2ray-plugin/blob/e9af1cdd2549d528deb20a4ab8d61c5fbe51f306/args.go#L172
|
||||||
|
// Equal signs and commas [and backslashes] must be escaped with a backslash.
|
||||||
|
base64Content = base64Content.Replace("\\", "\\\\").Replace("=", "\\=").Replace(",", "\\,");
|
||||||
|
|
||||||
pluginArgs += $"certRaw={base64Content};";
|
pluginArgs += $"certRaw={base64Content};";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue