[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: mail fltering
- From: Sean Conner <sean@...>
- Date: Sat, 11 May 2019 05:12:04 -0400
It was thus said that the Great Jim once stated:
> On 10/3/18, Sean Conner <sean@conman.org> wrote:
> > That's new to me, since I use Lua to process SIP messages for Verizon
> > Wireless. It currently handles around 60,000,000 messages per day without
> > issue (and we expect that level to rise 10-fold over the next year).
>
> given these sheer numbers you were not talking about emails, right ?
Right. SIP is (basically) a telephony protocol use mostly to connect
callers over non-legacy (non-SS7 basically) networks. What's nice about Lua
is that each transaction is handled via a coroutine driven by a network
event loop (itself written in Lua [1]). Parsing is handled by LPEG.
> i wonder if there is a Lua based smtpd available anywhere ?
> akin to Haraka (JS), qpsmtpd or ASSP (Perl) ?
>
> i only know that mailfront (
> http://www.untroubled.org/mailfront/
> ) can use Lua scripts for mail filtering.
>
> any other projects ?
I'm unaware of any other projects, but I do have LPEG code to parse
emails:
https://github.com/spc476/LPeg-Parsers/blob/master/email.lua
available via LuaRocks: "org.conman.parsers.email".
-spc
[1] https://github.com/spc476/lua-conmanorg/blob/master/lua/nfl.lua [2]
[2] No sample code uploaded yet, but here's a sample echo server using
the above module:
local signal = require "org.conman.signal"
local nfl = require "org.conman.nfl"
local tcp = require "org.conman.nfl.tcp"
-- ----------------------------------------------------------
-- This function will run in a coroutine until the other side
-- disconnects.
-- ----------------------------------------------------------
local function echo(ios)
local data = ios:read("*l")
if data and ios:write(data,"\r\n") then
return echo(ios)
end
ios:close()
end
signal.catch('int') -- so we can interrupt the program to stop it
tcp.listen('0.0.0.0','echo',echo)
nfl.server_event(function() return signal.caught() end)