From 94b85324bd73fc47625ec9b098fa97b97926a5d6 Mon Sep 17 00:00:00 2001 From: sbwml <984419930@qq.com> Date: Fri, 24 Mar 2023 23:36:37 +0800 Subject: [PATCH] luci-app-mosdns: Add enable_pipeline support for custom local DNS --- luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua | 7 +++---- luci-app-mosdns/po/zh-cn/mosdns.po | 4 ++-- luci-app-mosdns/root/etc/init.d/mosdns | 4 +++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua index 0dedd9b..4c2d218 100644 --- a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua +++ b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua @@ -40,10 +40,9 @@ redirect.default = true custom_local_dns = s:option(Flag, "custom_local_dns", translate("Local DNS"), translate("Follow WAN interface DNS if not enabled")) custom_local_dns:depends( "configfile", "/etc/mosdns/config.yaml") custom_local_dns.default = false - custom_local_dns = s:option(DynamicList, "local_dns", translate("Upstream DNS servers")) -custom_local_dns:value("119.29.29.29", "119.29.29.29 (DNSPod Primary)") -custom_local_dns:value("119.28.28.28", "119.28.28.28 (DNSPod Secondary)") +custom_local_dns:value("tls://1.12.12.12", "1.12.12.12 (DNSPod DoT Primary)") +custom_local_dns:value("tls://120.53.53.53", "120.53.53.53 (DNSPod DoT Secondary)") custom_local_dns:value("223.5.5.5", "223.5.5.5 (AliDNS Primary)") custom_local_dns:value("223.6.6.6", "223.6.6.6 (AliDNS Secondary)") custom_local_dns:value("114.114.114.114", "114.114.114.114 (114DNS Primary)") @@ -74,7 +73,7 @@ bootstrap_dns:value("180.76.76.76", "180.76.76.76 (Baidu DNS)") bootstrap_dns.default = "119.29.29.29" bootstrap_dns:depends( "configfile", "/etc/mosdns/config.yaml") -remote_dns_pipeline = s:option(Flag, "enable_pipeline", translate("Remote DNS Connection Multiplexing"), translate("Enable TCP/DoT RFC 7766 new Query Pipelining connection multiplexing mode")) +remote_dns_pipeline = s:option(Flag, "enable_pipeline", translate("Connection Multiplexing (TCP/DoT)"), translate("Enable TCP/DoT RFC 7766 new Query Pipelining connection multiplexing mode")) remote_dns_pipeline.rmempty = false remote_dns_pipeline.default = false remote_dns_pipeline:depends( "configfile", "/etc/mosdns/config.yaml") diff --git a/luci-app-mosdns/po/zh-cn/mosdns.po b/luci-app-mosdns/po/zh-cn/mosdns.po index 2432f0c..31f431c 100644 --- a/luci-app-mosdns/po/zh-cn/mosdns.po +++ b/luci-app-mosdns/po/zh-cn/mosdns.po @@ -127,8 +127,8 @@ msgstr "Bootstrap DNS 服务器用于解析你指定为上游的 DoH / DoT 解 msgid "Remote DNS" msgstr "远程 DNS" -msgid "Remote DNS Connection Multiplexing" -msgstr "远程 DNS 连接复用" +msgid "Connection Multiplexing (TCP/DoT)" +msgstr "连接复用(TCP/DoT)" msgid "Enable TCP/DoT RFC 7766 new Query Pipelining connection multiplexing mode" msgstr "启用 TCP/DoT RFC 7766 新型 Query Pipelining 连接复用模式" diff --git a/luci-app-mosdns/root/etc/init.d/mosdns b/luci-app-mosdns/root/etc/init.d/mosdns index d33b8f1..88e5e34 100755 --- a/luci-app-mosdns/root/etc/init.d/mosdns +++ b/luci-app-mosdns/root/etc/init.d/mosdns @@ -51,7 +51,9 @@ init_yaml() { tmpdir=$(mktemp -d) || exit 1 adlist=$(/usr/share/mosdns/mosdns.sh ad) [ $enable_pipeline = 1 ] && enable_pipeline=true || enable_pipeline=false - local_dns=$(/usr/share/mosdns/mosdns.sh dns | awk '{for(i=1;i<=NF;i++)printf "%s- addr: %s\n%s bootstrap: '${bootstrap_dns}'\n",s,$i,s}' s=' ') + [ "$custom_local_dns" -eq 1 ] && \ + local_dns=$(/usr/share/mosdns/mosdns.sh 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,$i,s,s}' s=' ') || \ + local_dns=$(/usr/share/mosdns/mosdns.sh dns | awk '{for(i=1;i<=NF;i++)printf "%s- addr: %s\n",s,$i,s}' s=' ') remote_dns=$(echo $remote_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,$i,s,s}' s=' ') sed "s,log_level,$log_level,g;s,log_file,$log_file,g; \ s,listen_port,$listen_port,g;s,cache_size,$cache_size,g; \