From 66a6b66fe328c642448b25337754ac8aa341ae72 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 20 Feb 2020 01:49:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=85=88=E5=8E=BB=E9=99=A4=E6=97=A7?= =?UTF-8?q?=EF=BC=88=E9=A1=B6=EF=BC=89=E9=A1=B9=E3=80=82=E4=B8=A5=E6=A0=BC?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=EF=BC=8C=E9=81=BF=E5=85=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=B8=8D=E5=90=8C=E7=9A=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v2rayN/v2rayN/Tool/Utils.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/v2rayN/v2rayN/Tool/Utils.cs b/v2rayN/v2rayN/Tool/Utils.cs index 2e840ecd..51ad9b2c 100644 --- a/v2rayN/v2rayN/Tool/Utils.cs +++ b/v2rayN/v2rayN/Tool/Utils.cs @@ -323,14 +323,32 @@ namespace v2rayN public static void DedupServerList(List source, out List result) { var list = new List(); + 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; }