-
Notifications
You must be signed in to change notification settings - Fork 187
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
新版本在处理"黑名单和白名单中都能匹配成功的域名"时似乎有些问题 #123
Comments
顺便一提,如果是对于 |
感谢反馈,大概知道是哪段逻辑的问题了。 之前版本的 gfwlist 和 chnlist 的数据结构是分开的,所以之前版本的 --gfwlist-frist --chnlist-first 逻辑很简单,就是先匹配哪个map。 新版本的 gfwlist 和 chnlist 放到同一个数据结构了(为了减少匹配次数,减少内存碎片),所以处理哪个列表优先的逻辑发生了改变:--gfwlist-frist --chnlist-first 变为先加载哪个list到数据结构中,因此对于同一级别的域名(label数量相同),肯定是先加载的优先级高。
对于这样一个域名:a.b.c.d,则匹配逻辑如下:
代入你说的情况:
在匹配 iqiyi.com 时,会被白名单命中,所以被判定为 tag:chn,因此走 china 上游 如果调用一下匹配顺序,应该就可以解决此问题,也就是改为:
对于 使用同一个父域名,然后通过不同子域来区分国家/地区 的情况,应该是可以解决问题的,比如上面说的 iqiyi.com;google这一类恰好相反,他们是通过不同的顶级域来区分 国家/地区,比如 google.com、google.de、google.com.hk、google.co.jp 等。 |
更新到最新版本试试。 |
感谢作者!!!刚刚测试了下最新版本,的确解决了上述问题。 |
最近在升级到新版本(ChinaDNS-NG 2023.04.11-2)后,观察到在处理"黑名单和白名单中都能匹配成功的域名"时和旧版本(ChinaDNS-NG v1.0-beta.25)的结果有所不同。为便于排查,新旧版本所用的命令行选项和黑白名单文件都相同,为
/usr/bin/chinadns-ng -b 0.0.0.0 -l 5334 -c 223.5.5.5 -t 127.0.0.1#5311 -g /etc/chinadns-ng/gfwlist.txt -m /etc/chinadns-ng/chinalist.txt -v
,按默认选项应该是优先黑名单。以下测试了
www.bloomberg.cn
和tw.iqiyi.com
这两个域名。前者分别匹配bloomberg.cn
在黑名单中,cn
在白名单中;后者有tw.iqiyi.com
在黑名单,iqiyi.com
在白名单。测试结果显示,旧版ChinaDNS-NG对于这两个域名都返回trust-dns(127.0.0.1#5311)结果,而新版却是返回china-dns(223.5.5.5#53)结果。日志如下:
旧版(v1.0-beta.25):
新版(2023.04.11-2)
不知是新版本的逻辑发生了变化,还是个bug?谢谢!
The text was updated successfully, but these errors were encountered: