From c27ed16e6ab428f00930eb5d3b68f3affff4a897 Mon Sep 17 00:00:00 2001 From: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Sat, 19 Dec 2020 12:17:55 +0800 Subject: [PATCH] Fix: DNS compatible with `localhost` nameserver (#530) --- app/dns/dns.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/dns/dns.go b/app/dns/dns.go index ee8b8acd7..0e135a1f2 100644 --- a/app/dns/dns.go +++ b/app/dns/dns.go @@ -64,6 +64,10 @@ func New(ctx context.Context, config *Config) (*DNS, error) { for _, ns := range config.NameServer { domainRuleCount += len(ns.PrioritizedDomain) } + // Fixes https://github.com/v2fly/v2ray-core/issues/529 + // Compatible with `localhost` nameserver specified in config file + domainRuleCount += len(localTLDsAndDotlessDomains) + // MatcherInfos is ensured to cover the maximum index domainMatcher could return, where matcher's index starts from 1 matcherInfos := make([]DomainMatcherInfo, domainRuleCount+1) domainMatcher := &strmatcher.MatcherGroup{}