diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-26 14:59:14 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-26 15:00:02 +0000 |
commit | 434255a2a71e508d1e1de2bda368572d62be7e3e (patch) | |
tree | c3d5730ab0a53d3f30fe16711fb7dbbb612411c3 /lualib/lua_scanners/init.lua | |
parent | e96cab20b996c1555ba0e5748057649c5ab82d8d (diff) | |
download | rspamd-434255a2a71e508d1e1de2bda368572d62be7e3e.tar.gz rspamd-434255a2a71e508d1e1de2bda368572d62be7e3e.zip |
[Rework] Lua_scanners: Further library split
Diffstat (limited to 'lualib/lua_scanners/init.lua')
-rw-r--r-- | lualib/lua_scanners/init.lua | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lualib/lua_scanners/init.lua b/lualib/lua_scanners/init.lua index 9937fd73f..149402874 100644 --- a/lualib/lua_scanners/init.lua +++ b/lualib/lua_scanners/init.lua @@ -19,8 +19,37 @@ limitations under the License. -- This module contains external scanners functions --]] +local fun = require "fun" + local exports = { - antivirus = require "lua_scanners/lua_antivirus", } +local function require_scanner(name) + local sc = require ("lua_scanners/" .. name) + + exports[sc.name or name] = sc +end + +require_scanner('clamav') +require_scanner('fprot') +require_scanner('kaspersky_av') +require_scanner('savapi') +require_scanner('sophos') + +exports.add_scanner = function(name, t, conf_func, check_func) + assert(type(conf_func) == 'function' and type(check_func) == 'function', + 'bad arguments') + exports[name] = { + type = t, + configure = conf_func, + check = check_func, + } +end + +exports.filter = function(t) + return fun.tomap(fun.filter(function(_, elt) + return type(elt) == 'table' and elt.type and elt.type == t + end, exports)) +end + return exports
\ No newline at end of file |