check_site.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. local fastd_methods = {'salsa2012+gmac', 'salsa2012+umac', 'null+salsa2012+gmac', 'null+salsa2012+umac', 'null'}
  2. need_array_of('fastd_mesh_vpn.methods', fastd_methods)
  3. need_number('fastd_mesh_vpn.mtu')
  4. need_boolean('fastd_mesh_vpn.enabled', false)
  5. need_boolean('fastd_mesh_vpn.configurable', false)
  6. need_one_of('fastd_mesh_vpn.syslog_level', {'error', 'warn', 'info', 'verbose', 'debug', 'debug2'}, false)
  7. local function check_peer(prefix)
  8. return function(k, _)
  9. assert_uci_name(k)
  10. local table = string.format('%s[%q].', prefix, k)
  11. need_string_match(table .. 'key', '^%x+$')
  12. need_string_array(table .. 'remotes')
  13. end
  14. end
  15. local function check_group(prefix)
  16. return function(k, _)
  17. assert_uci_name(k)
  18. local table = string.format('%s[%q].', prefix, k)
  19. need_number(table .. 'limit', false)
  20. need_table(table .. 'peers', check_peer(table .. 'peers'), false)
  21. need_table(table .. 'groups', check_group(table .. 'groups'), false)
  22. end
  23. end
  24. need_table('fastd_mesh_vpn.groups', check_group('fastd_mesh_vpn.groups'))
  25. if need_table('fastd_mesh_vpn.bandwidth_limit', nil, false) then
  26. need_boolean('fastd_mesh_vpn.bandwidth_limit.enabled', false)
  27. need_number('fastd_mesh_vpn.bandwidth_limit.ingress', false)
  28. need_number('fastd_mesh_vpn.bandwidth_limit.egress', false)
  29. end