Closed povsister closed 1 month ago
What I actually got after configuration parsed:
What are your reproduction steps for What I actually got after configuration parsed
? How is the second configuration generated/printed?
What are your reproduction steps for
What I actually got after configuration parsed
? How is the second configuration generated/printed?
The actual effective configuration is exported by adding stdout print code before+after config load. It can also be verified by adding some print code during config build.
From what I have seen, the issue reported here can be easily reproduced with v4 JSON config format. Other config formats are not tested.
@povsister Can reproduce with v2ray convert
.
However, dns tags do not work this way. The tag is only used for routing, and not participating in DNS server selection. It should be more like a bug with the parsing logic of v2ray convert
, rather than the DNS itself.
Can you check whether you can get expected behavior without any sorts of merging, just run with the config as-is?
However, dns tags do not work this way. The tag is only used for routing, and not participating in DNS server selection.
I know exactly what i am doing. I have two domestic DNS servers(one as primary and one as backup) with same rules/tags configured within the DNS server list, and I am intending to identitify and direct send domestic DNS traffic.
I have read the code of DNS processing, and I am sure those 2 domestic servers will be used in sequence for domestic sites.
it should be more like a bug with the parsing logic of
v2ray convert
, rather than the DNS itself.
I agree with that, too. As I have mentioned the "merging" behaviour referred in documentation, I don't think the same-tag-merging shoud be applied to DNS configurations.
Can you check whether you can get expected behavior without any sorts of merging, just run with the config as-is?
I am using a workaround right now, by configuring different tag on different servers. It works as expected now. For example:
{
// omitted
"dns": {
"queryStrategy": "UseIPv4",
"fallbackStrategy": "disabled-if-any-match",
"domainMatcher": "mph",
"servers": [
{
"address": "aaa.bbb.ccc.ddd", // DNS from ISP
"port": 53,
"domains": [
"geosite:cn"
],
"tag": "dns-domestic"
},
{
"address": "114.114.114.114", // 114 public DNS as backup
"port": 53,
"domains": [
"geosite:cn"
],
"tag": "dns-domestic-backup", // <- WORKAROUND HERE
},
{
"address": "https://1.1.1.1/dns-query", // Cloudflare DoH as default fallback
"tag": "dns-international",
}
]
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"domainMatcher": "mph",
"rules": [
// omitted
{
"type": "field",
"inboundTag": ["dns-domestic", "dns-domestic-backup"], // <- Don't forget to add tag here.
"outboundTag": "direct" // always direct sent domestic site DNS queries
},
{
"type": "field",
"inboundTag": "dns-international",
"outboundTag": "proxy" // proxy international cf DoH queries
}
// omitted
]
}
// omitted
}
See it. I would seek some time to look into the code and propose a fix for it.
What version of V2Ray are you using?
master build V2Ray 5.15.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.22.2 linux/amd64)
What's your scenario of using V2Ray?
Not related
What problems have you encountered?
Multiple DNS servers with same tag in a single configuration file are unexpected merged into one, with all domain rules merged together, and the last server's address & settings taken effect.
What's your expectation?
According to documentation here, same-tag-merging in slices should only take effect on
inbounds
andoutbounds
. so DNS servers with same tag in a single configuration file should be all preserved.Please attach your configuration here
What I typed in v4 configuration:
What I actually got after configuration parsed: