Browse Source

Fix: DNS compatible with `localhost` nameserver (#530)

Loyalsoldier 4 years ago
parent
commit
c27ed16e6a
1 changed files with 4 additions and 0 deletions
  1. 4 0
      app/dns/dns.go

+ 4 - 0
app/dns/dns.go

@@ -64,6 +64,10 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
 	for _, ns := range config.NameServer {
 	for _, ns := range config.NameServer {
 		domainRuleCount += len(ns.PrioritizedDomain)
 		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 is ensured to cover the maximum index domainMatcher could return, where matcher's index starts from 1
 	matcherInfos := make([]DomainMatcherInfo, domainRuleCount+1)
 	matcherInfos := make([]DomainMatcherInfo, domainRuleCount+1)
 	domainMatcher := &strmatcher.MatcherGroup{}
 	domainMatcher := &strmatcher.MatcherGroup{}