写了一个 CDN 友好+反污染的 DNS 服务器

2020 年 3 月 3 日
 suspended

Purified DNS

https://github.com/arloan/prdns

欢迎尝试。

13030 次点击
所在节点    DNS
54 条回复
tpsxiong
2020 年 3 月 3 日
reechangs
2020 年 3 月 3 日
@suspended #19 方法的确是好方法,但是这样查询速度会不会更慢?
gainsurier
2020 年 3 月 3 日
楼主注意保护好自己的隐私,有 wj,dns server 非常敏感。
suspended
2020 年 3 月 3 日
@reechangs 不会。对每个顶级域名,只有第一次会多查一次 DNS 记录,后续就已经知道这个域名是否是污染的,不会再去检测是否污染,会直接查国内 DNS/可信 DNS。
suspended
2020 年 3 月 3 日
@gainsurier 多谢提醒。不过没关系,最多也就是让我关掉这个 repo 而已。:D
yulihao
2020 年 3 月 3 日
是不是还要安装 net-dns ?
C:/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
: cannot load such file -- async/dns (LoadError)
yulihao
2020 年 3 月 3 日
@yulihao 装了也不行,我不懂 ruby 额
hhhsuan
2020 年 3 月 3 日
所以具体是什么机制? 能讲一下吗?
suspended
2020 年 3 月 3 日
@yulihao 倒是没有在 Windows 上测试过,不过 async/dns 在 prdns 的依赖项里,按说 gem install prdns 会自动把 async/dns 装上才对。试试再装一下 async/dns 吧:`gem install async-dns`
suspended
2020 年 3 月 3 日
@hhhsuan 13 楼有小伙伴解释了大致原理,更详细的原理可以直接看代码。
bonny23
2020 年 3 月 3 日
lz 的方案的确挺创新的,赞一个
hhhsuan
2020 年 3 月 3 日
那些有泛解析的域名怎么办? 所有的二级域名都能解析到一个地址。
suspended
2020 年 3 月 3 日
@hhhsuan 泛解析也是支持的:
```shell
suspended$ dig @localhost anything-is-resolved.bing.com

; <<>> DiG 9.8.3-P1 <<>> @localhost anything-is-resolved.bing.com
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39738
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;anything-is-resolved.bing.com. IN A

;; ANSWER SECTION:
anything-is-resolved.bing.com. 3600 IN CNAME star-bing-com.a-0001.a-msedge.net.
star-bing-com.a-0001.a-msedge.net. 60 IN CNAME dual-a-0001.a-msedge.net.
dual-a-0001.a-msedge.net. 49 IN A 13.107.21.200
dual-a-0001.a-msedge.net. 49 IN A 204.79.197.200

;; Query time: 43 msec
;; SERVER: ::1#53(::1)
;; WHEN: Tue Mar 3 18:25:13 2020
;; MSG SIZE rcvd: 152

```
suspended
2020 年 3 月 3 日
@suspended 晕,v2ex 回复不支持 markdown 的吗?也不能修改……
Yourshell
2020 年 3 月 3 日
污染不了就会被墙掉
hhhsuan
2020 年 3 月 3 日
@suspended #33 那怎么知道是正常的解析还是被墙了?
yulihao
2020 年 3 月 3 日
@hhhsuan 我不知道我的理解对不对,我的理解是 GFW 会针对如*.google.com ,只要是 google.com 他都返回一个值,因此随机修改*的字符串看看 GFW 有没有返回结果,若有则为污染
ZeroSimple
2020 年 3 月 3 日
支持一下。
不过小心搭,搭 DNS 似乎是违法的,会被查水表。之前有 V 友被查了。不过如果你已经肉身 fq 了当我没说
yulihao
2020 年 3 月 3 日
我来提交新 BUG ( windows 下的)
若输入的域名不存在或者查询超时,这边就会发生错误
| Errno::ECONNRESET: An existing connection was forcibly closed
by the remote host. - recvmsg(2)
| → C:/Ruby27-x64/lib/ruby/2.7.0/socket.rb 444
| C:/Ruby27-x64/lib/ruby/2.7.0/socket.rb 444
| C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/
async/io/generic.rb 216
| C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/
async/io/generic.rb 62
| C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/async-dns-1.2.5/lib/
async/dns/handler.rb 73
| C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/async-dns-1.2.5/lib/
async/dns/server.rb 114
| C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/async-io-1.27.3/lib/
async/io/socket.rb 169
| C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/async-1.24.2/lib/asy
nc/task.rb 258
5m28s warn: <> UDP response failed: #<IOError: closed stream>! [pid=13688]
[2020-03-03 20:39:44 +0800]

一会儿同时提交到你的 repo 那里,感谢有这样一种工具,希望能有效解决移动 dns 劫持
crella
2020 年 3 月 3 日
虽然楼主的本意是好,但是为啥要把这个项目放上 rubygems 上面去?万一哪一天 gems.ruby-china.com 被封了怎么办

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://v2ex.ih06.com/t/649297

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX