luci-app-mosdns: Add DNS.SB remote dns

This commit is contained in:
sbwml 2022-05-10 14:38:22 +08:00
parent b04e837e3f
commit b3da3aca88
3 changed files with 31 additions and 16 deletions

View File

@ -36,15 +36,28 @@ logfile.placeholder = "/tmp/mosdns.log"
logfile.default = "/tmp/mosdns.log" logfile.default = "/tmp/mosdns.log"
logfile:depends( "configfile", "/etc/mosdns/config.yaml") logfile:depends( "configfile", "/etc/mosdns/config.yaml")
dnsforward = s:option(Value, "dns_forward", translate("Remote DNS")) remote_dns = s:option(Value, "remote_dns1", translate("Remote DNS"))
dnsforward.rmempty = false remote_dns.rmempty = false
dnsforward.default = "tls://8.8.4.4" remote_dns.default = "tls://8.8.8.8"
dnsforward: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)")
dnsforward:value("tls://8.8.8.8", "8.8.8.8 (Google DNS)") remote_dns:value("tls://8.8.8.8", "8.8.8.8 (Google DNS)")
dnsforward:value("tls://8.8.4.4", "8.8.4.4 (Google DNS)") remote_dns:value("tls://8.8.4.4", "8.8.4.4 (Google DNS)")
dnsforward:value("208.67.222.222", "208.67.222.222 (Open DNS)") remote_dns:value("tls://185.222.222.222", "185.222.222.222 (DNS.SB)")
dnsforward:value("208.67.220.220", "208.67.220.220 (Open DNS)") remote_dns:value("tls://45.11.45.11", "45.11.45.11 (DNS.SB)")
dnsforward:depends( "configfile", "/etc/mosdns/config.yaml") remote_dns:value("208.67.222.222", "208.67.222.222 (Open DNS)")
remote_dns:value("208.67.220.220", "208.67.220.220 (Open DNS)")
remote_dns:depends( "configfile", "/etc/mosdns/config.yaml")
remote_dns = s:option(Value, "remote_dns2", " ")
remote_dns.rmempty = false
remote_dns.default = "tls://1.1.1.1"
remote_dns:value("tls://1.1.1.1", "1.1.1.1 (CloudFlare DNS)")
remote_dns:value("tls://8.8.8.8", "8.8.8.8 (Google DNS)")
remote_dns:value("tls://8.8.4.4", "8.8.4.4 (Google DNS)")
remote_dns:value("tls://185.222.222.222", "185.222.222.222 (DNS.SB)")
remote_dns:value("tls://45.11.45.11", "45.11.45.11 (DNS.SB)")
remote_dns:value("208.67.222.222", "208.67.222.222 (Open DNS)")
remote_dns:value("208.67.220.220", "208.67.220.220 (Open DNS)")
remote_dns:depends( "configfile", "/etc/mosdns/config.yaml")
cache_size = s:option(Value, "cache_size", translate("DNS Cache Size")) cache_size = s:option(Value, "cache_size", translate("DNS Cache Size"))
cache_size.datatype = "and(uinteger,min(0))" cache_size.datatype = "and(uinteger,min(0))"

View File

@ -10,7 +10,8 @@ config mosdns 'mosdns'
option configfile '/etc/mosdns/config.yaml' option configfile '/etc/mosdns/config.yaml'
option log_level 'error' option log_level 'error'
option logfile '/tmp/mosdns.log' option logfile '/tmp/mosdns.log'
option dns_forward 'tls://8.8.4.4' option remote_dns1 'tls://8.8.8.8'
option remote_dns2 'tls://1.1.1.1'
option cache_size '1024' option cache_size '1024'
option minimal_ttl '300' option minimal_ttl '300'
option maximum_ttl '3600' option maximum_ttl '3600'

View File

@ -79,6 +79,13 @@ plugin:
- addr: ${{ /usr/share/mosdns/dns.sh 0 }} - addr: ${{ /usr/share/mosdns/dns.sh 0 }}
- addr: ${{ /usr/share/mosdns/dns.sh 1 }} - addr: ${{ /usr/share/mosdns/dns.sh 1 }}
- tag: forward_remote
type: fast_forward
args:
upstream:
- addr: ${{ uci -q get mosdns.mosdns.remote_dns1 }}
- addr: ${{ uci -q get mosdns.mosdns.remote_dns2 }}
- tag: query_is_whitelist_domain - tag: query_is_whitelist_domain
type: query_matcher type: query_matcher
args: args:
@ -103,12 +110,6 @@ plugin:
rule: rule:
- "ext:/etc/mosdns/rule/redirect.txt" - "ext:/etc/mosdns/rule/redirect.txt"
- tag: forward_remote
type: fast_forward
args:
upstream:
- addr: ${{ uci -q get mosdns.mosdns.dns_forward }}
- tag: query_is_local_domain - tag: query_is_local_domain
type: query_matcher type: query_matcher
args: args: