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 328234e..660b2e7 100644
--- a/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua
+++ b/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua
@@ -2,6 +2,7 @@ local datatypes = require "luci.cbi.datatypes"
local white_list_file = "/etc/mosdns/rule/whitelist.txt"
local block_list_file = "/etc/mosdns/rule/blocklist.txt"
+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"
@@ -13,6 +14,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("hosts_list", translate("Hosts"))
s:tab("redirect_list", translate("Redirect"))
s:tab("local_ptr_list", translate("Block PTR"))
@@ -37,6 +39,16 @@ o.validate = function(self, value)
return value
end
+o = s:taboption("grey_list", TextValue, "greylist", "", "" .. translate("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.") .. "" .. "" .. 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(grey_list_file) or "" end
+o.write = function(self, section, value) nixio.fs.writefile(grey_list_file, value:gsub("\r\n", "\n")) end
+o.remove = function(self, section, value) nixio.fs.writefile(grey_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 01fc36b..0586c15 100644
--- a/luci-app-mosdns/po/zh-cn/mosdns.po
+++ b/luci-app-mosdns/po/zh-cn/mosdns.po
@@ -134,7 +134,7 @@ msgid "White Lists"
msgstr "白名单"
msgid "These domain names allow DNS resolution with the highest priority. Please input the domain names of websites, every line can input only one website domain. For example: hm.baidu.com."
-msgstr "加入的域名始终允许 DNS 解析,且优先级最高(每个域名一行,支持域名匹配规则)"
+msgstr "加入的域名始终允许使用 “本地 DNS” 进行解析,且优先级最高(每个域名一行,支持域名匹配规则)"
msgid "Block Lists"
msgstr "黑名单"
@@ -142,6 +142,12 @@ msgstr "黑名单"
msgid "These domains are blocked from DNS resolution. Please input the domain names of websites, every line can input only one website domain. For example: baidu.com."
msgstr "加入的域名将屏蔽 DNS 解析(每个域名一行,支持域名匹配规则)"
+msgid "Grey Lists"
+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 "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/greylist.txt b/luci-app-mosdns/root/etc/mosdns/rule/greylist.txt
new file mode 100644
index 0000000..8c956fc
--- /dev/null
+++ b/luci-app-mosdns/root/etc/mosdns/rule/greylist.txt
@@ -0,0 +1,3 @@
+domain:github.com
+regexp:.+\.google\.com$
+regexp:.+\.youtube\.com$
diff --git a/luci-app-mosdns/root/usr/share/mosdns/default.yaml b/luci-app-mosdns/root/usr/share/mosdns/default.yaml
index fc287cc..01f1f48 100644
--- a/luci-app-mosdns/root/usr/share/mosdns/default.yaml
+++ b/luci-app-mosdns/root/usr/share/mosdns/default.yaml
@@ -21,6 +21,10 @@ data_providers:
file: "/etc/mosdns/rule/blocklist.txt"
auto_reload: true
+ - tag: greylist
+ file: "/etc/mosdns/rule/greylist.txt"
+ auto_reload: true
+
- tag: hosts
file: "/etc/mosdns/rule/hosts.txt"
auto_reload: true
@@ -74,6 +78,12 @@ plugins:
domain:
- "provider:blocklist"
+ - tag: query_is_greylist_domain
+ type: query_matcher
+ args:
+ domain:
+ - "provider:greylist"
+
- tag: query_is_hosts_domain
type: hosts
args:
@@ -144,6 +154,12 @@ plugins:
- lazy_cache
+ - if: query_is_greylist_domain
+ exec:
+ - forward_remote
+ - modify_ttl
+ - _return
+
- if: query_is_local_domain
exec:
- forward_local