check_site.lua 950 B

123456789101112131415161718192021222324252627282930
  1. local fastd_methods = {'salsa2012+gmac', 'salsa2012+umac', 'null+salsa2012+gmac', 'null+salsa2012+umac', 'null'}
  2. need_array_of('mesh_vpn.fastd.methods', fastd_methods)
  3. need_boolean('mesh_vpn.fastd.configurable', false)
  4. need_one_of('mesh_vpn.fastd.syslog_level', {'error', 'warn', 'info', 'verbose', 'debug', 'debug2'}, false)
  5. local function check_peer(prefix)
  6. return function(k, _)
  7. assert_uci_name(k)
  8. local table = string.format('%s[%q].', prefix, k)
  9. need_string_match(table .. 'key', '^%x+$')
  10. need_string_array(table .. 'remotes')
  11. end
  12. end
  13. local function check_group(prefix)
  14. return function(k, _)
  15. assert_uci_name(k)
  16. local table = string.format('%s[%q].', prefix, k)
  17. need_number(table .. 'limit', false)
  18. need_table(table .. 'peers', check_peer(table .. 'peers'), false)
  19. need_table(table .. 'groups', check_group(table .. 'groups'), false)
  20. end
  21. end
  22. need_table('mesh_vpn.fastd.groups', check_group('mesh_vpn.fastd.groups'))