luci-app-mosdns: Add DDNS Lists support
* enforce ttl 5, no caches
This commit is contained in:
parent
6235e5d766
commit
f9852b8116
@ -6,6 +6,7 @@ local grey_list_file = "/etc/mosdns/rule/greylist.txt"
|
|||||||
local hosts_list_file = "/etc/mosdns/rule/hosts.txt"
|
local hosts_list_file = "/etc/mosdns/rule/hosts.txt"
|
||||||
local redirect_list_file = "/etc/mosdns/rule/redirect.txt"
|
local redirect_list_file = "/etc/mosdns/rule/redirect.txt"
|
||||||
local local_ptr_file = "/etc/mosdns/rule/local-ptr.txt"
|
local local_ptr_file = "/etc/mosdns/rule/local-ptr.txt"
|
||||||
|
local ddns_list_file = "/etc/mosdns/rule/ddnslist.txt"
|
||||||
|
|
||||||
m = Map("mosdns")
|
m = Map("mosdns")
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ s.anonymous = true
|
|||||||
s:tab("white_list", translate("White Lists"))
|
s:tab("white_list", translate("White Lists"))
|
||||||
s:tab("block_list", translate("Block Lists"))
|
s:tab("block_list", translate("Block Lists"))
|
||||||
s:tab("grey_list", translate("Grey Lists"))
|
s:tab("grey_list", translate("Grey Lists"))
|
||||||
|
s:tab("ddns_list", translate("DDNS Lists"))
|
||||||
s:tab("hosts_list", translate("Hosts"))
|
s:tab("hosts_list", translate("Hosts"))
|
||||||
s:tab("redirect_list", translate("Redirect"))
|
s:tab("redirect_list", translate("Redirect"))
|
||||||
s:tab("local_ptr_list", translate("Block PTR"))
|
s:tab("local_ptr_list", translate("Block PTR"))
|
||||||
@ -49,6 +51,16 @@ o.validate = function(self, value)
|
|||||||
return value
|
return value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
o = s:taboption("ddns_list", TextValue, "ddns", "", "<font color='red'>" .. translate("These domains are always resolved using local DNS. And force TTL 5 seconds, DNS resolution results will not enter the cache. For example: myddns.example.com.") .. "</font>" .. "<font color='#00bd3e'>" .. translate("<br>The list of rules only apply to 'Default Config' profiles.") .. "</font>")
|
||||||
|
o.rows = 15
|
||||||
|
o.wrap = "off"
|
||||||
|
o.cfgvalue = function(self, section) return nixio.fs.readfile(ddns_list_file) or "" end
|
||||||
|
o.write = function(self, section, value) nixio.fs.writefile(ddns_list_file, value:gsub("\r\n", "\n")) end
|
||||||
|
o.remove = function(self, section, value) nixio.fs.writefile(ddns_list_file, "") end
|
||||||
|
o.validate = function(self, value)
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
|
||||||
o = s:taboption("hosts_list", TextValue, "hosts", "", "<font color='red'>" .. translate("Hosts For example: baidu.com 10.0.0.1") .. "</font>" .. "<font color='#00bd3e'>" .. translate("<br>The list of rules only apply to 'Default Config' profiles.") .. "</font>")
|
o = s:taboption("hosts_list", TextValue, "hosts", "", "<font color='red'>" .. translate("Hosts For example: baidu.com 10.0.0.1") .. "</font>" .. "<font color='#00bd3e'>" .. translate("<br>The list of rules only apply to 'Default Config' profiles.") .. "</font>")
|
||||||
o.rows = 15
|
o.rows = 15
|
||||||
o.wrap = "off"
|
o.wrap = "off"
|
||||||
|
@ -268,6 +268,12 @@ msgstr "灰名单"
|
|||||||
msgid "These domains are always resolved using remote DNS. Please input the domain names of websites, every line can input only one website domain. For example: google.com."
|
msgid "These domains are always resolved using remote DNS. Please input the domain names of websites, every line can input only one website domain. For example: google.com."
|
||||||
msgstr "加入的域名始终使用 “远程 DNS” 进行解析(每个域名一行,支持域名匹配规则)"
|
msgstr "加入的域名始终使用 “远程 DNS” 进行解析(每个域名一行,支持域名匹配规则)"
|
||||||
|
|
||||||
|
msgid "DDNS Lists"
|
||||||
|
msgstr "DDNS 域名"
|
||||||
|
|
||||||
|
msgid "These domains are always resolved using local DNS. And force TTL 5 seconds, DNS resolution results will not enter the cache. For example: myddns.example.com."
|
||||||
|
msgstr "加入的域名始终使用 “本地 DNS” 进行解析,并且强制 TTL 5 秒,解析结果不会进入缓存(每个域名一行,支持域名匹配规则)"
|
||||||
|
|
||||||
msgid "Hosts For example: baidu.com 10.0.0.1"
|
msgid "Hosts For example: baidu.com 10.0.0.1"
|
||||||
msgstr "自定义 Hosts 重写,如:baidu.com 10.0.0.1(每个规则一行)"
|
msgstr "自定义 Hosts 重写,如:baidu.com 10.0.0.1(每个规则一行)"
|
||||||
|
|
||||||
|
0
luci-app-mosdns/root/etc/mosdns/rule/ddnslist.txt
Normal file
0
luci-app-mosdns/root/etc/mosdns/rule/ddnslist.txt
Normal file
@ -44,6 +44,12 @@ plugins:
|
|||||||
files:
|
files:
|
||||||
- "/etc/mosdns/rule/greylist.txt"
|
- "/etc/mosdns/rule/greylist.txt"
|
||||||
|
|
||||||
|
- tag: ddnslist
|
||||||
|
type: domain_set
|
||||||
|
args:
|
||||||
|
files:
|
||||||
|
- "/etc/mosdns/rule/ddnslist.txt"
|
||||||
|
|
||||||
- tag: hosts
|
- tag: hosts
|
||||||
type: hosts
|
type: hosts
|
||||||
args:
|
args:
|
||||||
@ -138,6 +144,15 @@ plugins:
|
|||||||
threshold: 500
|
threshold: 500
|
||||||
always_standby: true
|
always_standby: true
|
||||||
|
|
||||||
|
- tag: query_is_ddns_domain
|
||||||
|
type: sequence
|
||||||
|
args:
|
||||||
|
- matches: qname $ddnslist
|
||||||
|
exec: ttl 5
|
||||||
|
- exec: $forward_local
|
||||||
|
- matches: has_resp
|
||||||
|
exec: accept
|
||||||
|
|
||||||
- tag: query_is_local_domain
|
- tag: query_is_local_domain
|
||||||
type: sequence
|
type: sequence
|
||||||
args:
|
args:
|
||||||
@ -187,6 +202,7 @@ plugins:
|
|||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
- exec: $redirect
|
- exec: $redirect
|
||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
|
- exec: $query_is_ddns_domain
|
||||||
- exec: $query_is_whitelist_domain
|
- exec: $query_is_whitelist_domain
|
||||||
- exec: $query_is_reject_domain
|
- exec: $query_is_reject_domain
|
||||||
- exec: $cache
|
- exec: $cache
|
||||||
|
Loading…
Reference in New Issue
Block a user