Fix DNS match log

This commit is contained in:
世界 2024-12-15 21:27:39 +08:00
parent dda692e955
commit 5952c174f7
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -45,20 +45,22 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, ruleIndex int,
panic("no context")
}
var options dns.QueryOptions
if ruleIndex < len(r.dnsRules) {
dnsRules := r.dnsRules
var (
currentRuleIndex int
currentRule adapter.DNSRule
)
if ruleIndex != -1 {
dnsRules = dnsRules[ruleIndex+1:]
currentRuleIndex = ruleIndex + 1
}
for currentRuleIndex, currentRule := range dnsRules {
for currentRuleIndex, currentRule = range r.dnsRules[currentRuleIndex:] {
if currentRule.WithAddressLimit() && !isAddressQuery {
continue
}
metadata.ResetRuleCache()
if currentRule.Match(metadata) {
displayRuleIndex := currentRuleIndex
if displayRuleIndex != -1 {
displayRuleIndex += displayRuleIndex + 1
if ruleIndex != -1 {
displayRuleIndex += ruleIndex + 1
}
ruleDescription := currentRule.String()
if ruleDescription != "" {
@ -110,7 +112,6 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, ruleIndex int,
}
}
}
}
if domainStrategy, dsLoaded := r.transportDomainStrategy[r.defaultTransport]; dsLoaded {
options.Strategy = domainStrategy
} else {