luci-app-mosdns: Add enable_pipeline support for custom local DNS

This commit is contained in:
sbwml 2023-03-24 23:36:37 +08:00
parent 2adefe0246
commit 94b85324bd
3 changed files with 8 additions and 7 deletions

View File

@ -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 = 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:depends( "configfile", "/etc/mosdns/config.yaml")
custom_local_dns.default = false custom_local_dns.default = false
custom_local_dns = s:option(DynamicList, "local_dns", translate("Upstream DNS servers")) 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("tls://1.12.12.12", "1.12.12.12 (DNSPod DoT Primary)")
custom_local_dns:value("119.28.28.28", "119.28.28.28 (DNSPod Secondary)") 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.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("223.6.6.6", "223.6.6.6 (AliDNS Secondary)")
custom_local_dns:value("114.114.114.114", "114.114.114.114 (114DNS Primary)") 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.default = "119.29.29.29"
bootstrap_dns:depends( "configfile", "/etc/mosdns/config.yaml") 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.rmempty = false
remote_dns_pipeline.default = false remote_dns_pipeline.default = false
remote_dns_pipeline:depends( "configfile", "/etc/mosdns/config.yaml") remote_dns_pipeline:depends( "configfile", "/etc/mosdns/config.yaml")

View File

@ -127,8 +127,8 @@ msgstr "Bootstrap DNS 服务器用于解析你指定为上游的 DoH / DoT 解
msgid "Remote DNS" msgid "Remote DNS"
msgstr "远程 DNS" msgstr "远程 DNS"
msgid "Remote DNS Connection Multiplexing" msgid "Connection Multiplexing (TCP/DoT)"
msgstr "远程 DNS 连接复用" msgstr "连接复用TCP/DoT"
msgid "Enable TCP/DoT RFC 7766 new Query Pipelining connection multiplexing mode" msgid "Enable TCP/DoT RFC 7766 new Query Pipelining connection multiplexing mode"
msgstr "启用 TCP/DoT RFC 7766 新型 Query Pipelining 连接复用模式" msgstr "启用 TCP/DoT RFC 7766 新型 Query Pipelining 连接复用模式"

View File

@ -51,7 +51,9 @@ init_yaml() {
tmpdir=$(mktemp -d) || exit 1 tmpdir=$(mktemp -d) || exit 1
adlist=$(/usr/share/mosdns/mosdns.sh ad) adlist=$(/usr/share/mosdns/mosdns.sh ad)
[ $enable_pipeline = 1 ] && enable_pipeline=true || enable_pipeline=false [ $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=' ') 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; \ 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; \ s,listen_port,$listen_port,g;s,cache_size,$cache_size,g; \