-
Notifications
You must be signed in to change notification settings - Fork 4.3k
DNS New Features: disableCache
, finalQuery
, unexpectedIPs
, "*"
, UseSystem-queryStrategy
, useSystemHosts
#4666
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
@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 多级且每级范围可以自定义 |
@j2rong4cn 我刚看到 #4666 (comment) ,可以开个 PR |
@patterniha 这个 PR 加的 |
|
@RPRX
|
这俩就是兜底的,前面所有流程走完了还没选定 IP 就返回第一个 IP,所以不适用
A 查询和 AAAA 查询本来就指定了 IP 类型,这里两种都写只是方便这个 DNS Server 配置可以同时 cover 两种查询 |
For client/browser dns-query we have two distinct request for IPv4 and IPv6(pass through dns-proxy) so your changes does not affect this case . But for happy-eyeballs we use domainStrategy= ForceIP and we have one merged request for IPv4 and IPv6 but with your changes only one type of IPs is returned. DNS behaves differently when we have two separate requests or one merged request. |
那就改成一个简单的语法糖: |
改成
|
expectedIPs and unexpectedIPs should behave similarly. Also, if we have so In completion of your word: Let's make if same for /// in fact, we just replace |
I did this. so if so new documention is:
|
i add new built-in-dns should not return IPv6 for the system that not support IPv6 (unless user want to use returned-IP at the other side), this causes several problems that I can explain. currently for this problem we can create two configs, one for IPv4-network and one for dual-stack-network, but it is not convenient to change the configs all the time. so i add new when
(we can set at global-dns-settings, or each dns-server-settings) |
disableCache
, finalQuery
, unexpectedIPs
, "*"
, UseSystem
@patterniha 为什么不用net.InterfaceAddrs()?https://pkg.go.dev/net#InterfaceAddrs |
because [2001:4860:4860::8888] is a real wan-IP, we make sure that routing-table is also ok, and in practice we can bind a port for a wan-IPv6 address. /// but in addition, /// as a result, using udp-dial is definitely a better and more accurate way. (It also costs zero and only binds a port and then release) |
disableCache
, finalQuery
, unexpectedIPs
, "*"
, UseSystem
disableCache
, 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? |
New features:
disableCache
for 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.
///
finalQuery
for 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= true
for server-A, so any result from server-A return as a final-result and no other DNS-server will be performed.///
unexpectedIPs
for 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
unexpectedIPs
option, and an IP is matched if and only if does not match any of the IP-ranges in theunexpectedIPs
list, 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
expectedIPS
andunexpectedIPs
:expectedIPS=[range-A], unexpectedIPs=[range-B]
///
Add to Documentation: