|
|
@@ -82,7 +82,13 @@ func (r *Router) PickRoute(ctx routing.Context) (routing.Route, error) {
|
|
|
}
|
|
|
|
|
|
func (r *Router) pickRouteInternal(ctx routing.Context) (*Rule, routing.Context, error) {
|
|
|
- if r.domainStrategy == Config_IpOnDemand {
|
|
|
+
|
|
|
+ // SkipDNSResolve is set from DNS module.
|
|
|
+ // the DOH remote server maybe a domain name,
|
|
|
+ // this prevents cycle resolving dead loop
|
|
|
+ skipDNSResolve := ctx.GetSkipDNSResolve()
|
|
|
+
|
|
|
+ if r.domainStrategy == Config_IpOnDemand && !skipDNSResolve {
|
|
|
ctx = routing_dns.ContextWithDNSClient(ctx, r.dns)
|
|
|
}
|
|
|
|
|
|
@@ -92,7 +98,7 @@ func (r *Router) pickRouteInternal(ctx routing.Context) (*Rule, routing.Context,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if r.domainStrategy != Config_IpIfNonMatch || len(ctx.GetTargetDomain()) == 0 {
|
|
|
+ if r.domainStrategy != Config_IpIfNonMatch || len(ctx.GetTargetDomain()) == 0 || skipDNSResolve {
|
|
|
return nil, ctx, common.ErrNoClue
|
|
|
}
|
|
|
|