1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-20 14:35:23 +00:00

Fix: DNS compatible with localhost nameserver (#530)

This commit is contained in:
Loyalsoldier 2020-12-19 12:17:55 +08:00 committed by GitHub
parent d8c03f10b5
commit c27ed16e6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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{}