Skip to content

Commit

Permalink
fix: support multiple matches in hostfile
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Mar 10, 2023
1 parent 7caa26a commit 5331866
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 5331866

Please sign in to comment.