luci-app-mosdns: no longer using nslookup instead of bootstrap for http/3

* bootstrap work for http/3 has been fixed upstream
This commit is contained in:
sbwml 2023-09-28 17:21:32 +08:00
parent 17c41eb622
commit c7ea65276c
4 changed files with 9 additions and 18 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-mosdns
PKG_VERSION:=1.5.11
PKG_VERSION:=1.5.12
PKG_RELEASE:=1
LUCI_TITLE:=LuCI Support for mosdns

View File

@ -120,12 +120,12 @@ o.rmempty = false
o.default = false
o:depends("configfile", "/etc/mosdns/config.yaml")
o = s:taboption("advanced", Flag, "enable_http3_local", translate("Local DNS Enable HTTP/3"), translate("Enable DoH HTTP/3 protocol for Local DNS, Upstream DNS server support is required (Experimental)"))
o = s:taboption("advanced", Flag, "enable_http3_local", translate("China DNS Enable HTTP/3"), translate("Enable DoH HTTP/3 protocol for China DNS, Upstream DNS server support is required (Experimental feature)"))
o.rmempty = false
o.default = false
o:depends("custom_local_dns", "1")
o = s:taboption("advanced", Flag, "enable_http3_remote", translate("Remote DNS Enable HTTP/3"), translate("Enable DoH HTTP/3 protocol for Remote DNS, Upstream DNS server support is required (Experimental)"))
o = s:taboption("advanced", Flag, "enable_http3_remote", translate("Remote DNS Enable HTTP/3"), translate("Enable DoH HTTP/3 protocol for Remote DNS, Upstream DNS server support is required (Experimental feature)"))
o.rmempty = false
o.default = false
o:depends("configfile", "/etc/mosdns/config.yaml")

View File

@ -265,17 +265,17 @@ msgstr "禁用 TLS 证书"
msgid "Disable TLS Servers certificate validation, Can be useful if system CA certificate expires or the system time is out of order"
msgstr "禁用 TLS 服务器证书验证,当系统 CA 证书过期或系统时间错乱时,本选项可能会有用"
msgid "Local DNS Enable HTTP/3"
msgstr "本地 DNS 启用 HTTP/3"
msgid "China DNS Enable HTTP/3"
msgstr "国内 DNS 启用 HTTP/3"
msgid "Enable DoH HTTP/3 protocol for Local DNS, Upstream DNS server support is required (Experimental)"
msgstr "本地 DNS 启用 DoH HTTP/3 协议,需要上游 DNS 服务器支持(实验性,谨慎启用该功能)"
msgid "Enable DoH HTTP/3 protocol for China DNS, Upstream DNS server support is required (Experimental feature)"
msgstr "国内 DNS 启用 DoH HTTP/3 协议,需要上游 DNS 服务器支持(实验性功能)"
msgid "Remote DNS Enable HTTP/3"
msgstr "远程 DNS 启用 HTTP/3"
msgid "Enable DoH HTTP/3 protocol for Remote DNS, Upstream DNS server support is required (Experimental)"
msgstr "远程 DNS 启用 DoH HTTP/3 协议,需要上游 DNS 服务器支持(实验性,谨慎启用该功能)"
msgid "Enable DoH HTTP/3 protocol for Remote DNS, Upstream DNS server support is required (Experimental feature)"
msgstr "远程 DNS 启用 DoH HTTP/3 协议,需要上游 DNS 服务器支持(实验性功能)"
msgid "Enable EDNS client subnet"
msgstr "启用 EDNS 客户端子网"

View File

@ -30,7 +30,6 @@ DUMP_FILE=/etc/mosdns/cache.dump
DUMP_FILE_DEFAULT=/usr/share/mosdns/cache.dump
DEFAULT_CONF=/usr/share/mosdns/default.yaml
MOSDNS_SCRIPT=/usr/share/mosdns/mosdns.sh
RULE_HOSTS=/etc/mosdns/rule/hosts.txt
get_config() {
config_get enabled $1 enabled 0
@ -73,14 +72,6 @@ init_yaml() {
# HTTP/3
[ $enable_http3_local -eq 1 ] && enable_http3_local=true || enable_http3_local=false
[ $enable_http3_remote -eq 1 ] && enable_http3_remote=true || enable_http3_remote=false
if [ $enable_http3_local = true ]; then
http3_dns=$(uci get mosdns.config.local_dns)
echo "$http3_dns" | grep -oE 'https?://[^/]+' | while read -r domain; do
address=$(nslookup "${domain#*://}" ${bootstrap_dns} | grep -A2 Name | grep Address | awk '{print $2}')
sed -i "/${domain#*://}/d" $RULE_HOSTS
[ -n "$address" ] && echo ${domain#*://} $address >> $RULE_HOSTS
done
fi
# Write parameters
[ "$custom_local_dns" -eq 1 ] && \
local_dns=$($MOSDNS_SCRIPT dns | awk '{for(i=1;i<=NF;i++)printf "%s- addr: \"%s\"\n%s bootstrap: '${bootstrap_dns}'\n%s enable_pipeline: '${enable_pipeline}'\n%s max_conns: '${max_conns}'\n%s insecure_skip_verify: '${insecure_skip_verify}'\n%s idle_timeout: '${idle_timeout}'\n%s enable_http3: '${enable_http3_local}'\n",s,$i,s,s,s,s,s,s}' s=' ') || \