Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
dnsmasq 支持 TCP DNS:可替代 dns2tcp 功能,要启用此功能可设置如下
server=/google.com/8.8.8.8~53
,即原 UDP 的#
改成~
。保守稳定起见,我没有更新 dnsmasq 到最新版,在 2.78 的基础上尽量小的改动方案来实现 TCP DNS 功能,对 dnsmasq 的原主链路的入侵影响控制到最小:
TCP DNS 请求成功后,直接向本机发送 UDP 结果,原主链路收到 UDP 结果后的检查 server 的部分需接受本机发送的结果,也有一点小更改。
本来还实现了 TCP connection 复用,但竟然有问题没有调试成功,暂时先不上了。不复用 TCP 连接的情况下,初次查询耗时为 160 毫秒左右,比 dns2tcp 略好5~10毫秒,就算差不多吧,胜在少了一个进程,少了黄多代码,简单。