check_site.lua 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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'))
  23. if need_table('fastd_mesh_vpn.bandwidth_limit', nil, false) then
  24. need_boolean('fastd_mesh_vpn.bandwidth_limit.enabled', false)
  25. need_number('fastd_mesh_vpn.bandwidth_limit.ingress', false)
  26. need_number('fastd_mesh_vpn.bandwidth_limit.egress', false)
  27. end