diff --git a/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua b/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua
index 660b2e7..1d6554e 100644
--- a/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua
+++ b/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua
@@ -6,6 +6,7 @@ local grey_list_file = "/etc/mosdns/rule/greylist.txt"
local hosts_list_file = "/etc/mosdns/rule/hosts.txt"
local redirect_list_file = "/etc/mosdns/rule/redirect.txt"
local local_ptr_file = "/etc/mosdns/rule/local-ptr.txt"
+local ddns_list_file = "/etc/mosdns/rule/ddnslist.txt"
m = Map("mosdns")
@@ -15,6 +16,7 @@ s.anonymous = true
s:tab("white_list", translate("White Lists"))
s:tab("block_list", translate("Block Lists"))
s:tab("grey_list", translate("Grey Lists"))
+s:tab("ddns_list", translate("DDNS Lists"))
s:tab("hosts_list", translate("Hosts"))
s:tab("redirect_list", translate("Redirect"))
s:tab("local_ptr_list", translate("Block PTR"))
@@ -49,6 +51,16 @@ o.validate = function(self, value)
return value
end
+o = s:taboption("ddns_list", TextValue, "ddns", "", "" .. 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.") .. "" .. "" .. translate("
The list of rules only apply to 'Default Config' profiles.") .. "")
+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", "", "" .. translate("Hosts For example: baidu.com 10.0.0.1") .. "" .. "" .. translate("
The list of rules only apply to 'Default Config' profiles.") .. "")
o.rows = 15
o.wrap = "off"
diff --git a/luci-app-mosdns/po/zh-cn/mosdns.po b/luci-app-mosdns/po/zh-cn/mosdns.po
index eba7c14..e4cb52c 100644
--- a/luci-app-mosdns/po/zh-cn/mosdns.po
+++ b/luci-app-mosdns/po/zh-cn/mosdns.po
@@ -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."
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"
msgstr "自定义 Hosts 重写,如:baidu.com 10.0.0.1(每个规则一行)"
diff --git a/luci-app-mosdns/root/etc/mosdns/rule/ddnslist.txt b/luci-app-mosdns/root/etc/mosdns/rule/ddnslist.txt
new file mode 100644
index 0000000..e69de29
diff --git a/luci-app-mosdns/root/usr/share/mosdns/default.yaml b/luci-app-mosdns/root/usr/share/mosdns/default.yaml
index 6ccaf21..1b2b4d6 100644
--- a/luci-app-mosdns/root/usr/share/mosdns/default.yaml
+++ b/luci-app-mosdns/root/usr/share/mosdns/default.yaml
@@ -44,6 +44,12 @@ plugins:
files:
- "/etc/mosdns/rule/greylist.txt"
+ - tag: ddnslist
+ type: domain_set
+ args:
+ files:
+ - "/etc/mosdns/rule/ddnslist.txt"
+
- tag: hosts
type: hosts
args:
@@ -138,6 +144,15 @@ plugins:
threshold: 500
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
type: sequence
args:
@@ -187,6 +202,7 @@ plugins:
- exec: jump has_resp_sequence
- exec: $redirect
- exec: jump has_resp_sequence
+ - exec: $query_is_ddns_domain
- exec: $query_is_whitelist_domain
- exec: $query_is_reject_domain
- exec: $cache