From 5331866e46482a98ad7790bfd26a8109af39b5aa Mon Sep 17 00:00:00 2001 From: titanism <101466223+titanism@users.noreply.github.com> Date: Thu, 9 Mar 2023 19:57:00 -0600 Subject: [PATCH] fix: support multiple matches in hostfile --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 88e6fb5..2d6935d 100644 --- a/index.js +++ b/index.js @@ -930,9 +930,12 @@ class Tangerine extends dns.promises.Resolver { const matches = []; for (const rule of this.constructor.HOSTS._origin) { - if (rule.ip === ip && !answers.includes(rule.hostname)) { + if (rule.ip === ip) { matches.push(rule.ip); - if (matches.filter((m) => m === ip).length > 1) + if ( + matches.filter((m) => m === ip).length > 1 && + !answers.includes(rule.hostname) + ) answers.push(rule.hostname); } }