fix clash config

pull/2447/head
2dust 2022-06-28 14:44:46 +08:00
parent eddd38ff03
commit d418f79d8f
1 changed files with 12 additions and 0 deletions

View File

@ -956,6 +956,18 @@ namespace v2rayN.Handler
break;
case ECoreType.clash:
case ECoreType.clash_meta:
//remove the original
var indexPort = fileContent.FindIndex(t => t.Contains("port:"));
if (indexPort >= 0)
{
fileContent.RemoveAt(indexPort);
}
indexPort = fileContent.FindIndex(t => t.Contains("socks-port:"));
if (indexPort >= 0)
{
fileContent.RemoveAt(indexPort);
}
fileContent.Add($"port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundHttp)}");
fileContent.Add($"socks-port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundSocks)}");
break;