DNS New Features: disableCache, finalQuery, unexpectedIPs, "*", UseSystem-queryStrategy, useSystemHosts#4666
Conversation
|
@RPRX 我写了个只返回rcode的DNS服务,要不要合并到这里? {
"domains": [
"geosite:category-ads-all",
"domain:lan",
"regexp:^[^\\.]*$"
],
"skipFallback": true,
"finalQuery": true,
"address": "rcode://3"
} |
|
although, it is possible to add rcode-only-dns-server but it is better to add this feature to the i change the there is no difference between rcode=0, and rcode=3 or others in practice, because we don't return any IP in any case. anyway, if rcode-number is important for your job, you can extend anyway, @RPRX has to make the final decision and I just said my opinion. |
|
@patterniha |
so i think it is better to extend
This is definitely a better and more direct way, anyway @RPRX gives the final opinion. |
Good, let's do as you say. |
This comment was marked as off-topic.
This comment was marked as off-topic.
No, it is 100% compatible with current configuration. it does not change any current logic and configuration. I just move codes to "condition_geoip.go", because we need to have more general function for It seems like you looked too quickly. /// The only break is |
|
Thank you, as you are focused on Xray DNS, please have a look at this Issue too #4677 |
Check this out |
you should open a PR, I'm just a contributor like you. |
|
我觉得用 |
|
不过现在反选只支持 geo,如果有需要的话再加一个反选 IP/CIDR 的语法就差不多了 |
|
还有就是先 |
Yes, support inverse but:
|
First, We will rarely need both at the same time. |
这俩不就是为了配合起来使用的吗,expect 两次,且有一个明确在前面, |
|
话说我突然想到, 或许直接更改它的行为,改为不合并,确保数组内第一个就是 first,第二个就是 second,以此类推, |
|
|
|
我误解了你,你也误解了我,我本来以为你那个 但是这个误解正好导致一个更简洁而强大的想法:把 至于如何合并反选,我还得再想想 |
Suppose you want your IPs to be in range A but not in range B. Therefore, the presence of |
|
我觉得四个选项叠一起的话逻辑有点混乱,压成两个选项就行, |
|
这样就可以 cover 所有需求了,更少的配置项,更强大的功能 |
|
As i understand, you agree with So what is alternative for |
|
比如如下配置 "expectedIPs": ["geoip:us", "geoip:uk", "0.0.0.0/0", "::/0"],
"unexpectedIPs": ["10.10.34.0/24", "2001:4188:2:600:10:10:34:0/120"]逻辑是
|
|
|
这并不会严重破坏 并且如果有人要 third 或者更多,他也可以通过优先级顺序来实现 |
|
简单来说就是你的 PR 在广义范围上的 expected 功能只有两级且第二级只能全选,我提的是 expected 多级且每级范围可以自定义 |
disableCache, finalQuery, unexpectedIPs, "*", UseSystemdisableCache, finalQuery, unexpectedIPs, "*", UseSystem-queryStrategy, useSystemHosts
|
I had a goal (Serverless for Iran) and you helped me a lot to achieve my goal, but you neglected me near the end of my work.
Serverless-for-iran-anti-sanction-version is not yet complete and needs some-of-these-dns-new-features and happy-eyeballs to complete.
Many users on Telegram ask me for Serverless-for-iran-anti-sanction-version, According to the tests I did, it opens almost all services and websites (except telegram) in all ISPs in iran. Why does a PR take more than a month to be approved? |
|
|
|
I explained in #4666 (comment) why I used It doesn't matter which IP we check for, It is enough to check for a non-reserved IP. |
|
每次 dns 查询,你都额外 dial 两次 我的小霸王学习机受得了 |
|
哦,草 前脚刚在 LookupIP() 检查完 然而 QueryIP() 只被前者调用 人家原版的 QueryIP() 中再次检查是因为 Nameserver 也有自己的 v4 v6 option 也就是说每次 dns 查询至少无意义地 dial udp 四次
|
package main
import (
"net"
"testing"
)
func checkSystemNetwork() (supportIPv4 bool, supportIPv6 bool) {
conn4, err4 := net.Dial("udp4", "8.8.8.8:53")
if err4 != nil {
supportIPv4 = false
} else {
supportIPv4 = true
conn4.Close()
}
conn6, err6 := net.Dial("udp6", "[2001:4860:4860::8888]:53")
if err6 != nil {
supportIPv6 = false
} else {
supportIPv6 = true
conn6.Close()
}
return
}
func BenchmarkCheckSystemNetwork(b *testing.B) {
for i := 0; i < b.N; i++ {
checkSystemNetwork()
checkSystemNetwork()
}
}开销还挺大 |
|
This option is most commonly used on mobile-client-side, people are constantly switching between mobile-data and wi-fi. in Iran, Most ADSL/VDSL/FTTH do not support IPv6, but IPv6 is supported in most places for mobile-data. /// The cost of port-binding is almost zero, less than 0.1ms per bind, Also how many dns-lookup do we have per minute? checking supported-IP-versions only once, causes users to have to turn VPN off and on after each network change. This is an important feature for Serverless, please do not change that. |
|
你不是糊了 happy eyeballs 吗? 别告诉我你糊完了自己都没试一下 |
|
I add if a system doesn't support IPv6, an IPv6 should not selected for freedom-UseIP/ForceIP. |
|
|
别的都不提,你 QueryIP 为什么还要再查一次,你真的搞明白 dns 这一串函数的调用顺序了吗? |
|
你这个功能纯粹就是臆想的糊上去 |
we have two situations:
/// I tested and it takes less than 50ms for 1000 bind-and-close(0.05ms per bind-and-close), so the cost is negligible. Anyway if you still concern the cost, you can add |
|
我用 x86 跑,成本都是 1.7ms pre call,虽然是低功耗的 cpu 问题关键在于非移动端用它代价太大 |
|
1.7ms only for port binding!!!, I think you measured other-things too (or something is wrong with your benchmark) This has nothing to do with CPU-power, this is a simple thing. please run: and send the result. |
|
原来你是这么做 benchmark 的 |

New features:
disableCachefor each DNS-Server-Object:currently we have only one global disableCache option that affects all DNS-servers, but we may want to disable the cache only for a specific DNS-Server.
///
finalQueryfor DNS-Server-Object:**Suppose you want to use DNS-Server-A for "youtube.com", but use DNS-Server-B for other google sites and use DNS-Server-C for others, so you should set:
But for whatever reason, server-A may be unavailable for a while(for example, the network may be unreachable for a while) so it uses server-B for "youtube.com", but we don't want this to happen.
Currently, there is no mechanism to prevent using server-B for "youtube.com", this is due to strange behavior of
skipFallback(except creating custom-geosite where "youtube.com" is removed from "google" list, but this is not possible for all users)but now we can set
finalQuery= truefor server-A, so any result from server-A return as a final-result and no other DNS-server will be performed.///
unexpectedIPsfor DNS-Server-Object:**Suppose we want no IP to be in an IP-range-A, and if all IPs in IP-range-A, the next-dns-fallback performed.
for example for Serverless-for-Iran anti-sanction-version, i want to use a anti-sanction DNS, but goverment-run-anti-sanction-DNS only bypass sanctions and not filter.
IRGFW return 10.10.34.0/24, 2001:4188:2:600:10:10:34:0/120 range for blocked domain, so if the return-IPs is in these ranges, the fallback-DNS should be performed.
one way to achieve this goal is creating custom-geosite and then using
!sign, but this is not possible for all users.another way is to calculate reverse-CIDR-list, for example using online-tools to calculate reverse-CIDR-list, but the reverse-CIDR-list is long and it causes the configuration to be messy.
as a result i add
unexpectedIPsoption, and an IP is matched if and only if does not match any of the IP-ranges in theunexpectedIPslist, in other words:expectedIPs = [0.0.0.0/0, ::/0] - unexpectedIPs.also, we may need all IPs to be in range-A, and no IP to be in range B, so we need both
expectedIPSandunexpectedIPs:expectedIPS=[range-A], unexpectedIPs=[range-B]///
Add to Documentation: