lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sean Conner >And yes, there is TLS support, but it requires libtls [2].
Is there any method that could easily disable TLS?

On Thu, Jan 28, 2021 at 5:56 AM Sean Conner <sean@conman.org> wrote:
>
> It was thus said that the Great 孙世龙 sunshilong once stated:
> > Hi, list
> >
> > Besides LuaSocket, is there any other library that provides support
> > for the TCP and UDP transport layers for Lua?
> >
> > I am using vanilla Lua.
> >
> > Stable and open source project is preferred.
> > Any guideline or suggestion is welcome.
>
>   I wrote my own [1].  At the lowest level, I have org.conman.net, which
> supports making TCP, UDP, raw (if you call the functions correctly) and Unix
> sockets.  It also supports both IPv4 and IPv6 but this module is pretty low
> level.
>
>   Stepping up one level, I have org.conman.net.tcp and org.conman.net.tls,
> which gives back a Lua file-like object that support read() and write() you
> would expect.  And yes, there is TLS support, but it requires libtls [2].
>
>   And if you want to write an event based server, I have org.conman.nfl.tcp
> and org.conman.nfl.tls, which handle each connection in a coroutine.  I have
> two projects that use this, one for TCP [3] and one for TLS [4][5].
>
>   This code has been written for POSIX systems.
>
>   -spc
>
> [1]     Everything I mention is available here:
>
>         https://github.com/spc476/lua-conmanorg
>
> [2]     A version for OpenSSL: https://causal.agency/libretls/
>
> [3]     Starting here, which shows the main loop of each coroutine and how
>         to run the main event loop.  This is for TCP:
>
>         https://github.com/spc476/port70/blob/1d59a312fde53219e303504febc6013f3991baff/port70.lua#L141
>
> [4]     Starting here, which shows the main loop of each coroutine and how
>         to run the main event loop.  This is for TLS:
>
>         https://github.com/spc476/GLV-1.12556/blob/d2e32f97dd882670e206f57765425ee6c8d183ab/Lua/GLV-1.12556.lua#L288
>
> [5]     The list of modules used and what they do:
>
>         org.conman.net     - low level socket and IP address code
>         org.conman.net.tcp - blocking IO for TCP connections
>         org.conman.net.tls - blocking IO for TLS connections
>         org.conman.net.ios - provides a Lua file-like object API (also used
>                              for the non-blocking IO routines)
>         org.conman.nfl     - main event driver
>         org.conman.nfl.tcp - event driven IO for TCP connections
>         org.conman.nfl.tls - event driven IO for TLS connections
>         org.conman.pollset - select/poll/epoll/kqueue interface (same API
>                              presented for all backends)
>         org.conman.tls     - wrapper around libtls
>
>         There are some other modules used, but those are the main ones
>         centered around network activity.