summaryrefslogtreecommitdiffstats
path: root/lualib/lua_stat.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-17 13:30:26 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-17 13:30:26 +0000
commit820021f67c80d21ba9ebb332ee550a7d346153dd (patch)
treea6e0a265ce425416864afc4ca82dbd1d6e1663e0 /lualib/lua_stat.lua
parentd95c37cd3de33925150c573a77a425ca4865b6a6 (diff)
downloadrspamd-820021f67c80d21ba9ebb332ee550a7d346153dd.tar.gz
rspamd-820021f67c80d21ba9ebb332ee550a7d346153dd.zip
[Minor] Add received tokens
Diffstat (limited to 'lualib/lua_stat.lua')
-rw-r--r--lualib/lua_stat.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/lualib/lua_stat.lua b/lualib/lua_stat.lua
index 2fb633cd3..21870b27d 100644
--- a/lualib/lua_stat.lua
+++ b/lualib/lua_stat.lua
@@ -766,6 +766,25 @@ local function get_meta_stat_tokens(task, res, i)
i = i + 1
end
+ local rh = task:get_received_headers()
+
+ if rh and #rh > 0 then
+ local lim = math.min(5, #rh)
+ for j =1,lim do
+ local rcvd = rh[j]
+ local ip = rcvd.real_ip
+ if ip and ip:is_valid() and ip:get_version() == 4 then
+ local masked = ip:apply_mask(24)
+
+ rawset(res, i, string.format("#rcv:%s:%s", tostring(masked),
+ rcvd.proto))
+ lua_util.debugm("bayes", task, "added received token: %s",
+ res[i])
+ i = i + 1
+ end
+ end
+ end
+
return i
end