浏览代码

Fix DNS exchange index

Signed-off-by: 气息 <[email protected]>
气息 1 年之前
父节点
当前提交
0e120f8a44
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      route/router_dns.go

+ 4 - 4
route/router_dns.go

@@ -47,7 +47,7 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, index int) (con
 		if index != -1 {
 		if index != -1 {
 			dnsRules = dnsRules[index+1:]
 			dnsRules = dnsRules[index+1:]
 		}
 		}
-		for ruleIndex, rule := range dnsRules {
+		for currentRuleIndex, rule := range dnsRules {
 			metadata.ResetRuleCache()
 			metadata.ResetRuleCache()
 			if rule.Match(metadata) {
 			if rule.Match(metadata) {
 				detour := rule.Outbound()
 				detour := rule.Outbound()
@@ -60,11 +60,11 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, index int) (con
 				if isFakeIP && !allowFakeIP {
 				if isFakeIP && !allowFakeIP {
 					continue
 					continue
 				}
 				}
-				displayRuleIndex := ruleIndex
+				ruleIndex := currentRuleIndex
 				if index != -1 {
 				if index != -1 {
-					displayRuleIndex += index + 1
+					ruleIndex += index + 1
 				}
 				}
-				r.dnsLogger.DebugContext(ctx, "match[", displayRuleIndex, "] ", rule.String(), " => ", detour)
+				r.dnsLogger.DebugContext(ctx, "match[", ruleIndex, "] ", rule.String(), " => ", detour)
 				if isFakeIP || rule.DisableCache() {
 				if isFakeIP || rule.DisableCache() {
 					ctx = dns.ContextWithDisableCache(ctx, true)
 					ctx = dns.ContextWithDisableCache(ctx, true)
 				}
 				}