Replies: 5 comments 1 reply
-
Resolution LoopWhen sending DNS requests with DNS server address to be a domain, during route pick the domain may trigger a new round of DNS request, and the request may be handled by a DNS server with domain address, causing infinite resolution loop. Inspired by how FakeDNS deals with v2ray configs in v2ray-core/infra/conf/v4/lint.go Lines 16 to 23 in 1490ce6 We could collect all domains used in
The servers list could then be matched and handled by DNS clients with address to be simple IP address (e.g. a simple UDP DNS), or localhost. If in json config no DNS client specified to handle this list, it will be implicitly delegated to BTW, |
Beta Was this translation helpful? Give feedback.
-
FakeDNS WorkflowCurrently FakeDNS involves two important flows:
The current implementation of first flow is counter-intuitive because it places v2ray-core/features/routing/dns/context.go Lines 35 to 40 in 1490ce6 Considering To improve this workflow, we may regard
(Draft) For the second workflow, it would require many extra efforts for So, instead of integrating The json configuration will look like this: {
"servers": [
{
"address": "223.5.5.5",
"domains": [
"geosite:cn"
],
"expectIPs": [
"geoip:cn"
]
},
"8.8.8.8"
],
"fakedns": {
"priority": "some-priority-strategy",
"domains": [
"some-domain-matching-rules"
],
"...": "..."
}
} Therefore:
|
Beta Was this translation helpful? Give feedback.
-
Lookup Flow (Draft)One logic during Lookup that seems not so making sense: Lines 304 to 308 in 1490ce6 During DNS client selection, if the final selected clients are zero, it is because no server is matched and fallback round-robin query is disabled. Fallback is disabled to prevent DNS leak according to discussion I found, but |
Beta Was this translation helpful? Give feedback.
-
Config Initialization
Currently, many of DNS configs are applied for global scope, but sometimes user may want to apply a certain strategy for only a specific client.
For example, one may expect to enforce some domains to only use ipv6 address, which could be done by specifying matchers for these domains to a DNS client and set only this client's queryStrategy to
UseIpv6
, while keeping other clients to their own strategies.V2Ray actually provides a similar workflow for two configs:
clientIP
and fallback (disableFallback
andskipFallback
). What's not intuitive for fallback config is that it introduces two flag switches with different name.Current V2Ray introduces even more flag switches in a DNS config:
v2ray-core/app/dns/dns.go
Lines 29 to 35 in 1490ce6
We may refactor the DNS config workflow in this hierarchy design:
DNS
object only takes care of the management of static hosts and DNS clients, and all of its client configs will be forwarded so thatClient
object will hold their distinct configs, and json configs specified indns
scope is just used as global default config if not overridden in client's own json configs.So
DNS
andClient
struct will look like this:So:
Client
could have their own inboundtag
during routing decision, or just use the same tag globally configured byDNS
object.Client
could have their ownclientIP
Client
could have their ownqueryStrategy
, so some clients may be used to return only ipv4/ipv6 addresses for certain domains.Client
has theirfallbackStrategy
set separately. ThefallbackStrategy
may beenabled
,disabled
ordisabledIfAnyMatch
. The old globaldns.disableFallback
anddns.disableFallbackIfMatch
will be properly handled for backward compatibility.Client
has their owncacheStrategy
(currently only enabled or disabled)Beta Was this translation helpful? Give feedback.
All reactions