Browse Source

优先去除旧(顶)项。严格检查,避免删除参数不同的配置。

pull/542/head
YFdyh000 5 years ago
parent
commit
cf195c7694
  1. 22
      v2rayN/v2rayN/Tool/Utils.cs

22
v2rayN/v2rayN/Tool/Utils.cs

@ -323,14 +323,32 @@ namespace v2rayN
public static void DedupServerList(List<Mode.VmessItem> source, out List<Mode.VmessItem> result)
{
var list = new List<Mode.VmessItem>();
source.Reverse(); // Remove the early items first
bool _isAdded(Mode.VmessItem o, Mode.VmessItem n)
{
return o.configVersion == n.configVersion &&
o.configType == n.configType &&
o.address == n.address &&
o.port == n.port &&
o.id == n.id &&
o.alterId == n.alterId &&
o.security == n.security &&
o.network == n.network &&
o.headerType == n.headerType &&
o.requestHost == n.requestHost &&
o.path == n.path &&
o.streamSecurity == n.streamSecurity;
// skip (will remove) different remarks
}
foreach (var item in source)
{
if (!list.Exists(i => item.address == i.address && item.port == i.port && item.path == i.path))
if (!list.Exists(i => _isAdded(i, item)))
{
list.Add(item);
}
}
list.Reverse();
result = list;
}

Loading…
Cancel
Save