Module rspamd_udp

Rspamd UDP module is available from the version 1.9.0 and represents a generic UDP asynchronous client available from the LUA code. This module is quite simple: it can either send requests to some address or it can send requests and wait for replies, potentially handling retransmits.


local logger = require "rspamd_logger"
local udp = require "rspamd_udp"

rspamd_config.SYM = function(task)
    host = addr, -- must be ip address object (e.g. received by upstream module)
    port = 500,
    data = {'str1', 'str2'}, -- can be table, string or rspamd_text
    timeout = 0.5, -- default = 1s
    task = task, -- if has task
    session = session, -- optional
    ev_base = ev_base, -- if no task available
    -- You can include callback and then Rspamd will try to read replies
    callback = function(success, data)
      -- success is bool, data is either data or an error (string)
    retransmits = 0, -- Or more if retransmitting is necessary


Brief content:


Function Description
rspamd_udp.sendto({params}) This function simply sends data to an external UDP service.


The module rspamd_udp defines the following functions.

Function rspamd_udp.sendto({params})

This function simply sends data to an external UDP service

  • task: rspamd task objects (implies pool, session and ev_base arguments)
  • ev_base: event base (if no task specified)
  • session: events session (no task, optional)
  • pool: memory pool (if no task specified)
  • host: IP or name of the peer (required)
  • port: remote port to use (if host has no port part this is required)
  • data: a table of strings or rspamd_text objects that contains data pieces
  • retransmits: number of retransmits if needed
  • callback: optional callback if reply should be read


No parameters


  • {boolean}: true if request has been sent (additional string if it has not)

Back to module description.

Back to top.