summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-12 15:42:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-12 15:42:58 +0100
commite29277ca2048c114459ca7c6c6b25b6e1e0f2ee1 (patch)
treea88e2b542d728467068576a293f605ccb130f0c9 /src/plugins
parentcdc100b748c784d1c8e55aee647dfed53b6df893 (diff)
downloadrspamd-e29277ca2048c114459ca7c6c6b25b6e1e0f2ee1.tar.gz
rspamd-e29277ca2048c114459ca7c6c6b25b6e1e0f2ee1.zip
[Feature] Add maps based on Top Level Domains
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/multimap.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 7e83988c6..8a2b21ddf 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -93,6 +93,9 @@ local function apply_hostname_filter(task, filter, hostname, r)
if filter == 'tld' then
local tld = util.get_tld(hostname)
return tld
+ elseif filter == 'top' then
+ local tld = util.get_tld(hostname)
+ return tld:match('[^.]*$') or tld
else
if not r['re_filter'] then
local pat = string.match(filter, 'tld:regexp:(.+)')
@@ -123,6 +126,9 @@ local function apply_url_filter(task, filter, url, r)
if filter == 'tld' then
return url:get_tld()
+ elseif filter == 'top' then
+ local tld = url:get_tld()
+ return tld:match('[^.]*$') or tld
elseif filter == 'full' then
return url:get_text()
elseif filter == 'is_phished' then