7ccdacd294
In addition to significant internal differences in check_site_lib.lua (in particular unifying error handling to a single place for the upcoming multi-domain support), this changes the way fields are addressed in site check scripts: rather than providing a string like 'next_node.ip6', the path is passed as an array {'next_node', 'ip6'}. Other changes in site check scripts: * need_array and need_table now pass the full path to the sub fields to the subcheck instead of the key and value * Any check referring to a field inside a table implies that all higher levels must be tables if they exist: a check for {'next_node', 'ip6'} adds an implicit (optional) check for {'next_node'}, which allows to remove many explicit checks for such tables
23 lines
813 B
Lua
23 lines
813 B
Lua
local fastd_methods = {'salsa2012+gmac', 'salsa2012+umac', 'null+salsa2012+gmac', 'null+salsa2012+umac', 'null'}
|
|
need_array_of({'mesh_vpn', 'fastd', 'methods'}, fastd_methods)
|
|
need_boolean(in_site({'mesh_vpn', 'fastd', 'configurable'}), false)
|
|
|
|
need_one_of(in_site({'mesh_vpn', 'fastd', 'syslog_level'}), {'error', 'warn', 'info', 'verbose', 'debug', 'debug2'}, false)
|
|
|
|
local function check_peer(k)
|
|
need_alphanumeric_key(k)
|
|
|
|
need_string_match(in_domain(extend(k, {'key'})), '^%x+$')
|
|
need_string_array(in_domain(extend(k, {'remotes'})))
|
|
end
|
|
|
|
local function check_group(k)
|
|
need_alphanumeric_key(k)
|
|
|
|
need_number(extend(k, {'limit'}), false)
|
|
need_table(extend(k, {'peers'}), check_peer, false)
|
|
need_table(extend(k, {'groups'}), check_group, false)
|
|
end
|
|
|
|
need_table({'mesh_vpn', 'fastd', 'groups'}, check_group)
|