diff --git a/v2rayN/v2rayN/Tool/Utils.cs b/v2rayN/v2rayN/Tool/Utils.cs index b7da94e8..232d5cff 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; }