luci-app-xray icon indicating copy to clipboard operation
luci-app-xray copied to clipboard

功能需求:可否增加 dns over https 支持

Open yukeiyang opened this issue 3 years ago • 12 comments

目前的封堵已经越来越针对 dns 部分,是否可以在 DNS Settings 部分的 Fast DNS / Secure DNS / Default DNS 增加对 dns over https (DOH) 的支持?

目前无法在 DNS 中填入 doh 地址,默认不支持。

yukeiyang avatar Sep 07 '21 16:09 yukeiyang

#69

yichya avatar Sep 07 '21 16:09 yichya

另外其实,我预期的用法是

  • Secure DNS 和 Default DNS 填一个没在 geoip:cn 里面的 DNS 比如 8.8.8.8 之类,这些 DNS 请求都会通过 Xray 转发出去
  • Fast DNS 预期只用来解析明确不会被污染的域名(默认是 geosite:cn

这两种情况都不需要 DoH,而且也都比 DoH 要快。

当然 DoH 的支持已经在 #69 合并上去了,所以有需求直接用就好。

yichya avatar Sep 07 '21 17:09 yichya

So, 我重新编译 ipk 就可以了?

yukeiyang avatar Sep 07 '21 17:09 yukeiyang

So, 我重新编译 ipk 就可以了?

等下我提一下版本号,因为最近在考虑顺便加点东西所以给忘了(太忙了。。。)

yichya avatar Sep 07 '21 17:09 yichya

感谢。

yukeiyang avatar Sep 07 '21 17:09 yukeiyang

现在可以了?

yukeiyang avatar Sep 07 '21 17:09 yukeiyang

现在可以了?

嗯,可以了

yichya avatar Sep 07 '21 17:09 yichya

Cool, 感谢。

yukeiyang avatar Sep 07 '21 17:09 yukeiyang

看了一下,DoH 的配置还有些问题,会各种影响 iptables 和 dnsmasq 的行为。#69 先回滚掉了,后面再认真考虑一下怎么做

yichya avatar Oct 09 '21 08:10 yichya

@yichya Fast DNS 最好也能使用 DoH

yukeiyang avatar Oct 09 '21 13:10 yukeiyang

看了一下,DoH 的配置还有些问题,会各种影响 iptables 和 dnsmasq 的行为。#69 先回滚掉了,后面再认真考虑一下怎么做

主要是ipset那儿,按下面这么改就行。把域名提取出来塞到ipset里,虽然报warning但能用。dnsmasq那边我没改,我自己的版本里把dnsmasq的配置整块注释掉了……

diff --git a/root/etc/init.d/xray b/root/etc/init.d/xray
index 3e6e41a..a6af2b1 100644
--- a/root/etc/init.d/xray
+++ b/root/etc/init.d/xray
@@ -64,9 +64,9 @@ gen_config_file() {
 setup_firewall() {
     /usr/bin/transparent-proxy-ipset \
         -B "$(uci_get_by_type general wan_bp_list)" \
-        -b "$(uci_get_by_type general wan_bp_ips) $(uci_get_by_type general fast_dns)" \
+        -b "$(uci_get_by_type general wan_bp_ips) $(uci_get_by_type general fast_dns | sed -E 's@https://([^/]+)/.*@\1@')" \
         -W "$(uci_get_by_type general wan_fw_list)" \
-        -w "$(uci_get_by_type general wan_fw_ips) $(uci_get_by_type general secure_dns)" \
+        -w "$(uci_get_by_type general wan_fw_ips) $(uci_get_by_type general secure_dns | sed -E 's@https://([^/]+)/.*@\1@')" \
         -d "$(uci_get_by_type general lan_target)" \
         -a "$(config_foreach get_lan_hosts lan_hosts)"
     /usr/bin/lua ${FIREWALL_INCLUDE} enable > $(uci get firewall.xray.path)

ttimasdf avatar Oct 10 '21 12:10 ttimasdf

如果dnsmasq要改,也可以用上面的正则把fastdns参数传入的DoH服务器域名提取出来,解析好,把解析结果塞到dnsmasq配置里。因为常见的DoH服务商什么阿里啊CF啊谷歌啊,域名对应的IP 53端口udp都是都能用的,用户填一个DoH服务器,传给dnsmasq它也能用。

ttimasdf avatar Oct 10 '21 12:10 ttimasdf