File: test_dns_client.lua

package info (click to toggle)
rspamd 3.14.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 35,064 kB
  • sloc: ansic: 247,728; cpp: 107,741; javascript: 31,385; perl: 3,089; asm: 2,512; pascal: 1,625; python: 1,510; sh: 589; sql: 313; makefile: 195; xml: 74
file content (30 lines) | stat: -rw-r--r-- 743 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local rspamd_dns = require "rspamd_dns"
local logger = require "rspamd_logger"

local config_path = rspamd_paths['CONFDIR'] .. '/rspamd.conf'
local _r,err = rspamd_config:load_ucl(config_path)

if not _r then
  logger.errx('cannot parse %s: %s (r=%s)', config_path, err, _r)
  os.exit(1)
end

_r,err = rspamd_config:parse_rcl({'logging', 'worker'})
if not _r then
  logger.errx('cannot process %s: %s (r=%s)', config_path, err, _r)
  os.exit(1)
end

rspamd_config:init_subsystem('dns', rspamadm_ev_base)


local is_ok, results = rspamd_dns.request({
     config = rspamd_config,
     session = rspamadm_session,

     type = 'txt',
     name = 'test._domainkey.example.com',
     -- name = '_dmarc.google.com',
   })

print(is_ok, results[1])