luci-app-mosdns: Add bootstrap for remote DNS

This commit is contained in:
sbwml 2023-03-24 23:16:16 +08:00
parent 51123e7951
commit 2adefe0246
4 changed files with 14 additions and 14 deletions

View File

@ -51,17 +51,6 @@ custom_local_dns:value("114.114.115.115", "114.114.115.115 (114DNS Secondary)")
custom_local_dns:value("180.76.76.76", "180.76.76.76 (Baidu DNS)") custom_local_dns:value("180.76.76.76", "180.76.76.76 (Baidu DNS)")
custom_local_dns:depends("custom_local_dns", "1") custom_local_dns:depends("custom_local_dns", "1")
custom_local_dns = s:option(ListValue, "bootstrap_dns", translate("Bootstrap DNS servers"), translate("Bootstrap DNS servers are used to resolve IP addresses of the DoH/DoT resolvers you specify as upstreams"))
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("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)")
custom_local_dns:value("114.114.115.115", "114.114.115.115 (114DNS Secondary)")
custom_local_dns:value("180.76.76.76", "180.76.76.76 (Baidu DNS)")
custom_local_dns.default = "119.29.29.29"
custom_local_dns:depends("custom_local_dns", "1")
remote_dns = s:option(DynamicList, "remote_dns", translate("Remote DNS")) remote_dns = s:option(DynamicList, "remote_dns", translate("Remote DNS"))
remote_dns:value("tls://1.1.1.1", "1.1.1.1 (CloudFlare DNS)") remote_dns:value("tls://1.1.1.1", "1.1.1.1 (CloudFlare DNS)")
remote_dns:value("tls://1.0.0.1", "1.0.0.1 (CloudFlare DNS)") remote_dns:value("tls://1.0.0.1", "1.0.0.1 (CloudFlare DNS)")
@ -74,6 +63,17 @@ remote_dns:value("tls://208.67.222.222", "208.67.222.222 (Open DNS)")
remote_dns:value("tls://208.67.220.220", "208.67.220.220 (Open DNS)") remote_dns:value("tls://208.67.220.220", "208.67.220.220 (Open DNS)")
remote_dns:depends( "configfile", "/etc/mosdns/config.yaml") remote_dns:depends( "configfile", "/etc/mosdns/config.yaml")
bootstrap_dns = s:option(ListValue, "bootstrap_dns", translate("Bootstrap DNS servers"), translate("Bootstrap DNS servers are used to resolve IP addresses of the DoH/DoT resolvers you specify as upstreams"))
bootstrap_dns:value("119.29.29.29", "119.29.29.29 (DNSPod Primary)")
bootstrap_dns:value("119.28.28.28", "119.28.28.28 (DNSPod Secondary)")
bootstrap_dns:value("223.5.5.5", "223.5.5.5 (AliDNS Primary)")
bootstrap_dns:value("223.6.6.6", "223.6.6.6 (AliDNS Secondary)")
bootstrap_dns:value("114.114.114.114", "114.114.114.114 (114DNS Primary)")
bootstrap_dns:value("114.114.115.115", "114.114.115.115 (114DNS Secondary)")
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("Remote DNS Connection Multiplexing"), 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

View File

@ -122,7 +122,7 @@ msgid "Bootstrap DNS servers"
msgstr "Bootstrap DNS 服务器" msgstr "Bootstrap DNS 服务器"
msgid "Bootstrap DNS servers are used to resolve IP addresses of the DoH/DoT resolvers you specify as upstreams" msgid "Bootstrap DNS servers are used to resolve IP addresses of the DoH/DoT resolvers you specify as upstreams"
msgstr "Bootstrap DNS 服务器用于解析指定为上游的 DoH / DoT 解析器的 IP 地址" msgstr "Bootstrap DNS 服务器用于解析指定为上游的 DoH / DoT 解析器的 IP 地址"
msgid "Remote DNS" msgid "Remote DNS"
msgstr "远程 DNS" msgstr "远程 DNS"

View File

@ -16,6 +16,7 @@ config mosdns 'config'
option maximum_ttl '0' option maximum_ttl '0'
option custom_local_dns '0' option custom_local_dns '0'
option enable_pipeline '0' option enable_pipeline '0'
option bootstrap_dns '119.29.29.29'
list remote_dns 'tls://8.8.8.8' list remote_dns 'tls://8.8.8.8'
list remote_dns 'tls://1.1.1.1' list remote_dns 'tls://1.1.1.1'

View File

@ -52,7 +52,7 @@ init_yaml() {
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=' ') 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=' ')
remote_dns=$(echo $remote_dns | awk '{for(i=1;i<=NF;i++)printf "%s- addr: %s\n%s enable_pipeline: '${enable_pipeline}'\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; \ 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; \
s,cache_survival_time,$cache_survival_time,g; \ s,cache_survival_time,$cache_survival_time,g; \
@ -64,7 +64,6 @@ init_yaml() {
echo "${remote_dns}" > $tmpdir/remote_dns.txt echo "${remote_dns}" > $tmpdir/remote_dns.txt
sed -i -e '/- addr: local_dns/{r '$tmpdir/local_dns.txt -e';d};/- addr: remote_dns/{r '$tmpdir/remote_dns.txt -e';d}' \ sed -i -e '/- addr: local_dns/{r '$tmpdir/local_dns.txt -e';d};/- addr: remote_dns/{r '$tmpdir/remote_dns.txt -e';d}' \
$CONF $CONF
[ "$custom_local_dns" -eq 0 ] && sed -i "/bootstrap/d" $CONF
rm -rf $tmpdir rm -rf $tmpdir
} }