@@ -20,6 +20,7 @@ limitations under the License. | |||
]]-- | |||
local rspamd_logger = require "rspamd_logger" | |||
local ts = require("tableshape").types | |||
local exports = {} | |||
@@ -315,4 +316,24 @@ end | |||
exports.rspamd_maybe_check_map = rspamd_maybe_check_map | |||
exports.map_schema = ts.one_of{ | |||
ts.string, -- 'http://some_map' | |||
ts.array_of(ts.string), -- ['foo', 'bar'] | |||
ts.shape{ -- complex object | |||
name = ts.string:is_optional(), | |||
description = ts.string:is_optional(), | |||
timeout = ts.number, | |||
data = ts.array_of(ts.string):is_optional(), | |||
-- Tableshape has no options support for something like key1 or key2? | |||
upstreams = ts.one_of{ | |||
ts.string, | |||
ts.array_of(ts.string), | |||
}:is_optional(), | |||
url = ts.one_of{ | |||
ts.string, | |||
ts.array_of(ts.string), | |||
}:is_optional(), | |||
} | |||
} | |||
return exports |
@@ -27,6 +27,7 @@ local lua_util = require 'lua_util' | |||
local ts = require("tableshape").types | |||
local selectors = require "lua_selectors" | |||
local bit = require 'bit' | |||
local lua_maps = require "lua_maps" | |||
-- This plugin implements various types of RBL checks | |||
-- Documentation can be found here: | |||
@@ -799,7 +800,7 @@ local default_options = { | |||
opts = lua_util.override_defaults(default_options, opts) | |||
if(opts['local_exclude_ip_map'] ~= nil) then | |||
local_exclusions = rspamd_map_add(N, 'local_exclude_ip_map', 'radix', | |||
local_exclusions = lua_maps.map_add(N, 'local_exclude_ip_map', 'radix', | |||
'RBL exclusions map') | |||
end | |||