luci-app-mosdns: only one Bootstrap DNS is required

This commit is contained in:
sbwml 2022-12-04 17:22:37 +08:00
parent fe2caaab18
commit 4b22f16e6d
3 changed files with 4 additions and 16 deletions

View File

@ -51,7 +51,7 @@ 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_dns1", translate("Bootstrap DNS servers")) 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.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("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.5.5.5", "223.5.5.5 (AliDNS Primary)")
@ -61,16 +61,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.default = "119.29.29.29" custom_local_dns.default = "119.29.29.29"
custom_local_dns:depends("custom_local_dns", "1") custom_local_dns:depends("custom_local_dns", "1")
custom_local_dns = s:option(ListValue, "bootstrap_dns2", " ", 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 = "223.5.5.5"
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)")

View File

@ -42,8 +42,7 @@ get_config() {
config_get redirect $1 redirect 0 config_get redirect $1 redirect 0
config_get remote_dns $1 remote_dns "tls://8.8.8.8 tls://1.1.1.1" config_get remote_dns $1 remote_dns "tls://8.8.8.8 tls://1.1.1.1"
config_get custom_local_dns $1 custom_local_dns 0 config_get custom_local_dns $1 custom_local_dns 0
config_get bootstrap_dns1 $1 bootstrap_dns1 "119.29.29.29" config_get bootstrap_dns $1 bootstrap_dns "119.29.29.29"
config_get bootstrap_dns2 $1 bootstrap_dns2 "223.5.5.5"
} }
init_yaml() { init_yaml() {
@ -60,7 +59,7 @@ init_yaml() {
s,adblock,$adblock,g;s,remote_dns_pipeline,$enable_pipeline,g" \ s,adblock,$adblock,g;s,remote_dns_pipeline,$enable_pipeline,g" \
/usr/share/mosdns/default.yaml > $CONF /usr/share/mosdns/default.yaml > $CONF
[ "$custom_local_dns" -eq 0 ] && sed -i "/bootstrap/d" $CONF || \ [ "$custom_local_dns" -eq 0 ] && sed -i "/bootstrap/d" $CONF || \
sed -i "s,bootstrap_dns1,$bootstrap_dns1,g;s,bootstrap_dns2,$bootstrap_dns2,g" $CONF sed -i "s,bootstrap_dns,$bootstrap_dns,g" $CONF
echo "${local_dns}" > $tmpdir/local_dns.txt echo "${local_dns}" > $tmpdir/local_dns.txt
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}' \

View File

@ -60,8 +60,7 @@ plugins:
upstream: upstream:
- addr: local_dns - addr: local_dns
bootstrap: bootstrap:
- "bootstrap_dns1" - "bootstrap_dns"
- "bootstrap_dns2"
- tag: "forward_remote" - tag: "forward_remote"
type: fast_forward type: fast_forward