check_site.lua 813 B

12345678910111213141516171819202122
  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(in_site({'mesh_vpn', 'fastd', 'configurable'}), false)
  4. need_one_of(in_site({'mesh_vpn', 'fastd', 'syslog_level'}), {'error', 'warn', 'info', 'verbose', 'debug', 'debug2'}, false)
  5. local function check_peer(k)
  6. need_alphanumeric_key(k)
  7. need_string_match(in_domain(extend(k, {'key'})), '^%x+$')
  8. need_string_array(in_domain(extend(k, {'remotes'})))
  9. end
  10. local function check_group(k)
  11. need_alphanumeric_key(k)
  12. need_number(extend(k, {'limit'}), false)
  13. need_table(extend(k, {'peers'}), check_peer, false)
  14. need_table(extend(k, {'groups'}), check_group, false)
  15. end
  16. need_table({'mesh_vpn', 'fastd', 'groups'}, check_group)