-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(dns): add parallel query #5239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
67cef37 to
8b8abe9
Compare
|
Is there any with combination of 5237 and 5239? |
https://github.com/Meo597/Xray-core/actions/runs/18633074311 |
This comment was marked as resolved.
This comment was marked as resolved.
|
第一版糊的太粗糙了 因为一旦发现需要过滤 IP 就退出竞速模式(虽然并发请求,但是等所有结果返回再匹配) 而且除 IP 过滤外, 现在改了第二版: 为了不增加用户心智负担,特意把并发查询做成傻瓜模式 现在的设计能完全 cover 需求,并解决了这些坑:
{
"dns": {
"servers": [
// 走直连试探 geosite:cn
// 要求必须返回中国IP
{
"tag": "dns-direct",
"address": "223.5.5.5",
"skipFallback": true,
"domains": ["geosite:cn"],
"expectIPs": ["geoip:cn"]
},
{
"tag": "dns-direct",
"address": "114.114.114.114",
"skipFallback": true,
"domains": ["geosite:cn"],
"expectIPs": ["geoip:cn"]
},
// 走代理试探 geosite:geolocation-!cn
// 要求必须返回国外IP
{
"address": "8.8.8.8",
"skipFallback": true,
"domains": ["geosite:geolocation-!cn"],
"expectIPs": ["geoip:!cn"]
},
{
"address": "1.1.1.1",
"skipFallback": true,
"domains": ["geosite:geolocation-!cn"],
"expectIPs": ["geoip:!cn"]
},
{
// 未知域名、或者是上面规则回落下来的
// 走代理,但用ECS试探是不是在中国
// 不是就继续回落,获取代理CDN友好的IP
"address": "8.8.8.8",
"clientIp": "222.85.85.85", // 你当地ISP的地址,这样直连CDN友好
"skipFallback": false,
"expectIPs": ["geoip:cn"]
},
{
"address": "8.8.4.4",
"clientIp": "222.85.85.85",
"skipFallback": false,
"expectIPs": ["geoip:cn"]
},
"1.1.1.1"
],
"tag": "dns-proxy",
"enableParallelQuery": true
}
}
|
|
目前三个 PR 在我的用例下测了几天,没发现什么问题。 只是设计上仍有些小瑕疵:
仅备忘,暂时不想动了 |
|
@t-e-s-tweb |
Yes. This is the one that I am using. Its working fine. Only the logs show context cancelled or empty responses but the sites are browsable and connecting. But there isn't anyway to check if cache is being hit or optimistic is being used. Parallel queries logs do show them working. |
|
因为我把 debug 日志那几行给注释掉了,它们设计的不好,太“重”了 我晚点看一下 ctx 取消是咋回事 |
Thanks. Here is the complete logcat for the domain. |
之前就猜测过这块可能有问题,但我只用 udp 所以没发现 |
|
然后被我注释掉的那两行 cache debug log 因为我搜了下各种热点函数都在 errors.LogDebug Logger 应该先判定 level 再拼字符串 |
|
@t-e-s-tweb 感谢测试与反馈!
现在,非 disableCache 的服务器,处于并发查询模式下,会忽略 caller 的 ctx.cancel() 以充分预热缓存。
把 debug 日志加回去了。 测试时还发现一个 xray 原有的 bug: 其实这样还是有问题,如果什么 app 无视 rcode 3 疯狂重试 |


不过滤 ip 且有多个上游时,会选最快响应的,能轻微降低延迟;上游故障时能显著降低延迟多层回落 ip 过滤,如果某层有多个上游,但其中一个响应太慢也会拖慢速度,此 pr 无法 cover,除非启用乐观缓存缓解;或者未来把 DnsServerObject 内部改成多个上游且并行{ "dns": { "enableParallelQuery": true } }缓存重构(#5248)、乐观缓存(#5237)、并发查询(#5239)
三个 PR 相互冲突,如果全部接受得按这个顺序 merge
我好 rebase
此 PR rebase 后的 diff
https://github.com/Meo597/Xray-core/compare/rebased-new-dns/optimistic-caching..rebased-new-dns/parallel-query