Software / code / prosody
Comparison
net/server_event.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 |
| parent | 12480:7e9ebdc75ce4 |
| child | 12542:5ec9d6913162 |
comparison
equal
deleted
inserted
replaced
| 12480:7e9ebdc75ce4 | 12481:2ee27587fec7 |
|---|---|
| 50 local has_luasec = pcall ( require , "ssl" ) | 50 local has_luasec = pcall ( require , "ssl" ) |
| 51 local socket = require "socket" | 51 local socket = require "socket" |
| 52 local levent = require "luaevent.core" | 52 local levent = require "luaevent.core" |
| 53 local inet = require "util.net"; | 53 local inet = require "util.net"; |
| 54 local inet_pton = inet.pton; | 54 local inet_pton = inet.pton; |
| 55 local sslconfig = require "util.sslconfig"; | |
| 56 local tls_impl = require "net.tls_luasec"; | |
| 55 | 57 |
| 56 local socket_gettime = socket.gettime | 58 local socket_gettime = socket.gettime |
| 57 | 59 |
| 58 local log = require ("util.logger").init("socket") | 60 local log = require ("util.logger").init("socket") |
| 59 | 61 |
| 942 get_backend = get_backend, | 944 get_backend = get_backend, |
| 943 hook_signal = hook_signal, | 945 hook_signal = hook_signal, |
| 944 add_task = add_task, | 946 add_task = add_task, |
| 945 watchfd = watchfd, | 947 watchfd = watchfd, |
| 946 | 948 |
| 949 tls_builder = function(basedir) | |
| 950 return sslconfig._new(tls_impl.new_context, basedir) | |
| 951 end, | |
| 952 | |
| 947 __NAME = SCRIPT_NAME, | 953 __NAME = SCRIPT_NAME, |
| 948 __DATE = LAST_MODIFIED, | 954 __DATE = LAST_MODIFIED, |
| 949 __AUTHOR = SCRIPT_AUTHOR, | 955 __AUTHOR = SCRIPT_AUTHOR, |
| 950 __VERSION = SCRIPT_VERSION, | 956 __VERSION = SCRIPT_VERSION, |
| 951 | 957 |