check_site.lua 806 B

123456789101112131415161718192021222324252627282930
  1. need_string_array('fastd_mesh_vpn.methods')
  2. need_number('fastd_mesh_vpn.mtu')
  3. need_boolean('fastd_mesh_vpn.enabled', false)
  4. need_boolean('fastd_mesh_vpn.configurable', 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(table .. 'key')
  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('fastd_mesh_vpn.groups', check_group('fastd_mesh_vpn.groups'))