Mercurial > prosody-hg
diff net/server_epoll.lua @ 12481:2ee27587fec7
net: refactor sslconfig to not depend on LuaSec
This now requires that the network backend exposes a tls_builder
function, which essentially wraps the former util.sslconfig.new()
function, passing a factory to create the eventual SSL context.
That allows a net.server backend to pick whatever it likes as SSL
context factory, as long as it understands the config table passed by
the SSL config builder. Heck, a backend could even mock and replace the
entire SSL config builder API.
| author | Jonas Schäfer <jonas@wielicki.name> |
|---|---|
| date | Sat, 02 Apr 2022 11:15:33 +0200 |
| parents | 7e9ebdc75ce4 |
| children | b7f07585ec4c |
line wrap: on
line diff
--- a/net/server_epoll.lua Wed Apr 27 17:44:14 2022 +0200 +++ b/net/server_epoll.lua Sat Apr 02 11:15:33 2022 +0200 @@ -27,6 +27,8 @@ local _SOCKETINVALID = socket._SOCKETINVALID or -1; local new_id = require "util.id".short; local xpcall = require "util.xpcall".xpcall; +local sslconfig = require "util.sslconfig"; +local tls_impl = require "net.tls_luasec"; local poller = require "util.poll" local EEXIST = poller.EEXIST; @@ -1104,6 +1106,10 @@ cfg = setmetatable(newconfig, default_config); end; + tls_builder = function(basedir) + return sslconfig._new(tls_impl.new_context, basedir) + end, + -- libevent emulation event = { EV_READ = "r", EV_WRITE = "w", EV_READWRITE = "rw", EV_LEAVE = -1 }; addevent = function (fd, mode, callback)
