check_site.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. need_one_of('fastd_mesh_vpn.syslog_level', {'error', 'warn', 'info', 'verbose', 'debug', 'debug2'}, false)
  6. local function check_peer(prefix)
  7. return function(k, _)
  8. assert_uci_name(k)
  9. local table = string.format('%s[%q].', prefix, k)
  10. need_string(table .. 'key')
  11. need_string_array(table .. 'remotes')
  12. end
  13. end
  14. local function check_group(prefix)
  15. return function(k, _)
  16. assert_uci_name(k)
  17. local table = string.format('%s[%q].', prefix, k)
  18. need_number(table .. 'limit', false)
  19. need_table(table .. 'peers', check_peer(table .. 'peers'), false)
  20. need_table(table .. 'groups', check_group(table .. 'groups'), false)
  21. end
  22. end
  23. need_table('fastd_mesh_vpn.groups', check_group('fastd_mesh_vpn.groups'))
  24. if need_table('fastd_mesh_vpn.bandwidth_limit', nil, false) then
  25. need_boolean('fastd_mesh_vpn.bandwidth_limit.enabled', false)
  26. need_number('fastd_mesh_vpn.bandwidth_limit.ingress', false)
  27. need_number('fastd_mesh_vpn.bandwidth_limit.egress', false)
  28. end