You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rspamd_test_helper.lua 880B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. local ffi = require "ffi"
  2. local cfg = rspamd_config
  3. ffi.cdef[[
  4. void rspamd_url_init (const char *tld_file);
  5. ]]
  6. local exports = {}
  7. local function default_tld_file()
  8. local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1")
  9. return string.format('%s/unit/%s', test_dir, "test_tld.dat")
  10. end
  11. function exports.init_url_parser(file)
  12. ffi.C.rspamd_url_init(file or default_tld_file())
  13. end
  14. function exports.default_config()
  15. local tld_file = default_tld_file()
  16. local config = {
  17. options = {
  18. filters = {'spf', 'dkim', 'regexp'},
  19. url_tld = tld_file,
  20. dns = {
  21. nameserver = {'8.8.8.8'}
  22. },
  23. },
  24. logging = {
  25. type = 'console',
  26. level = 'debug'
  27. },
  28. metric = {
  29. name = 'default',
  30. actions = {
  31. reject = 100500,
  32. },
  33. unknown_weight = 1
  34. }
  35. }
  36. return config
  37. end
  38. return exports