From 4b25902d76cb9d69f863ee9b98754d77b8dade96 Mon Sep 17 00:00:00 2001 From: sbwml Date: Mon, 27 Mar 2023 09:55:14 +0800 Subject: [PATCH] luci-app-mosdns: Add DNS Servers concurrency setting --- luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua | 6 ++++++ luci-app-mosdns/po/zh-cn/mosdns.po | 6 ++++++ luci-app-mosdns/root/etc/config/mosdns | 1 + luci-app-mosdns/root/etc/init.d/mosdns | 2 ++ luci-app-mosdns/root/usr/share/mosdns/default.yaml | 2 ++ 5 files changed, 17 insertions(+) diff --git a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua index a21d464..d4f18d2 100644 --- a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua +++ b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua @@ -88,6 +88,12 @@ o:depends("configfile", "/etc/mosdns/config.yaml") s:tab("advanced", translate("Advanced Options")) +o = s:taboption("advanced", Value, "concurrent", translate("Concurrent"), translate("DNS query request concurrency, The number of upstream DNS servers that are allowed to initiate requests at the same time")) +o.datatype = "and(uinteger,min(1))" +o.datatype = "and(uinteger,max(3))" +o.default = "1" +o:depends("configfile", "/etc/mosdns/config.yaml") + o = s:taboption("advanced", Flag, "enable_pipeline", translate("TCP/DoT Connection Multiplexing"), translate("Enable TCP/DoT RFC 7766 new Query Pipelining connection multiplexing mode")) o.rmempty = false o.default = false diff --git a/luci-app-mosdns/po/zh-cn/mosdns.po b/luci-app-mosdns/po/zh-cn/mosdns.po index 2227973..5b5b5c4 100644 --- a/luci-app-mosdns/po/zh-cn/mosdns.po +++ b/luci-app-mosdns/po/zh-cn/mosdns.po @@ -142,6 +142,12 @@ msgstr "Bootstrap DNS 服务器用于解析您指定为上游的 DoH / DoT 解 msgid "Remote DNS" msgstr "远程 DNS" +msgid "Concurrent" +msgstr "DNS 服务器并发数(默认 1)" + +msgid "DNS query request concurrency, The number of upstream DNS servers that are allowed to initiate requests at the same time" +msgstr "DNS 查询请求并发数,允许同时发起请求的上游 DNS 服务器数量" + msgid "TCP/DoT Connection Multiplexing" msgstr "TCP/DoT 连接复用" diff --git a/luci-app-mosdns/root/etc/config/mosdns b/luci-app-mosdns/root/etc/config/mosdns index 31c054a..1b72df1 100644 --- a/luci-app-mosdns/root/etc/config/mosdns +++ b/luci-app-mosdns/root/etc/config/mosdns @@ -13,6 +13,7 @@ config mosdns 'config' option cache_size '20000' option cache_survival_time '86400' option dump_file '0' + option concurrent '1' option minimal_ttl '0' option maximum_ttl '0' option custom_local_dns '0' diff --git a/luci-app-mosdns/root/etc/init.d/mosdns b/luci-app-mosdns/root/etc/init.d/mosdns index a740d3c..bc2e360 100755 --- a/luci-app-mosdns/root/etc/init.d/mosdns +++ b/luci-app-mosdns/root/etc/init.d/mosdns @@ -55,6 +55,7 @@ get_config() { config_get bootstrap_dns $1 bootstrap_dns "119.29.29.29" config_get enabled_api $1 enabled_api 0 config_get listen_port_api $1 listen_port_api 9091 + config_get concurrent $1 concurrent 1 } init_yaml() { @@ -70,6 +71,7 @@ init_yaml() { s,cache_survival_time,$cache_survival_time,g; \ s,minimal_ttl_custom,$minimal_ttl_custom,g; \ s,maximum_ttl_custom,$maximum_ttl_custom,g; \ + s,concurrent_num,$concurrent,g; \ s,adblock,$adlist,g;s,remote_dns_pipeline,$enable_pipeline,g" $DEFAULT_CONF > $CONF echo "${local_dns}" > $TMPDIR/local_dns.txt echo "${remote_dns}" > $TMPDIR/remote_dns.txt diff --git a/luci-app-mosdns/root/usr/share/mosdns/default.yaml b/luci-app-mosdns/root/usr/share/mosdns/default.yaml index bbe281f..ee7ef2d 100644 --- a/luci-app-mosdns/root/usr/share/mosdns/default.yaml +++ b/luci-app-mosdns/root/usr/share/mosdns/default.yaml @@ -83,12 +83,14 @@ plugins: - tag: forward_local type: forward args: + concurrent: concurrent_num upstreams: - addr: local_dns - tag: forward_remote type: forward args: + concurrent: concurrent_num upstreams: - addr: remote_dns