]]--
local rspamd_logger = require "rspamd_logger"
+local ts = require("tableshape").types
local exports = {}
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
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:
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