Skip to content

Commit 0e120f8

Browse files
szoucnekohasekai
authored andcommitted
Fix DNS exchange index
Signed-off-by: 气息 <[email protected]>
1 parent d918863 commit 0e120f8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

route/router_dns.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, index int) (con
4747
if index != -1 {
4848
dnsRules = dnsRules[index+1:]
4949
}
50-
for ruleIndex, rule := range dnsRules {
50+
for currentRuleIndex, rule := range dnsRules {
5151
metadata.ResetRuleCache()
5252
if rule.Match(metadata) {
5353
detour := rule.Outbound()
@@ -60,11 +60,11 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, index int) (con
6060
if isFakeIP && !allowFakeIP {
6161
continue
6262
}
63-
displayRuleIndex := ruleIndex
63+
ruleIndex := currentRuleIndex
6464
if index != -1 {
65-
displayRuleIndex += index + 1
65+
ruleIndex += index + 1
6666
}
67-
r.dnsLogger.DebugContext(ctx, "match[", displayRuleIndex, "] ", rule.String(), " => ", detour)
67+
r.dnsLogger.DebugContext(ctx, "match[", ruleIndex, "] ", rule.String(), " => ", detour)
6868
if isFakeIP || rule.DisableCache() {
6969
ctx = dns.ContextWithDisableCache(ctx, true)
7070
}

0 commit comments

Comments
 (0)