gluon/package/gluon-mesh-vpn-fastd/check_site.lua

25 lines
828 B
Lua
Raw Normal View History

local fastd_methods = {'salsa2012+umac', 'null+salsa2012+umac', 'null@l2tp', 'null'}
need_array_of({'mesh_vpn', 'fastd', 'methods'}, fastd_methods)
need_boolean(in_site({'mesh_vpn', 'fastd', 'configurable'}), false)
need_number({'mesh_vpn', 'fastd', 'mtu'})
2014-07-05 00:48:56 +00:00
2019-06-16 18:06:45 +00:00
need_one_of(in_site({'mesh_vpn', 'fastd', 'syslog_level'}),
{'error', 'warn', 'info', 'verbose', 'debug', 'debug2'}, false)
2014-07-05 00:48:56 +00:00
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'})))
2014-07-05 00:48:56 +00:00
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)