Skip to content

Commit

Permalink
luci-app-mosdns: no longer using nslookup instead of bootstrap for ht…
Browse files Browse the repository at this point in the history
…tp/3

* bootstrap work for http/3 has been fixed upstream
  • Loading branch information
sbwml committed Sep 28, 2023
1 parent 17c41eb commit c7ea652
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion luci-app-mosdns/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
12 changes: 6 additions & 6 deletions luci-app-mosdns/po/zh-cn/mosdns.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 客户端子网"
Expand Down
9 changes: 0 additions & 9 deletions luci-app-mosdns/root/etc/init.d/mosdns
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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=' ') || \
Expand Down

0 comments on commit c7ea652

Please sign in to comment.