feat: Adds new module to unlimit jicofo and jvb connections.

In case limited those connection will be whitelisted and unlimited. Updates existing configurations to make sure prosody update will not break it by limiting too much.

Uses 28c16c93d79a version of the module: https://modules.prosody.im/mod_limits_exception.html
Will be available in prosody 0.12.
This commit is contained in:
damencho
2021-05-24 15:52:25 -05:00
committed by Дамян Минков
parent c4677be87a
commit 15c08f90c4
3 changed files with 44 additions and 5 deletions

View File

@@ -0,0 +1,24 @@
-- we use async to detect Prosody 0.10 and earlier
local have_async = pcall(require, 'util.async');
if not have_async then
return;
end
local unlimited_jids = module:get_option_inherited_set("unlimited_jids", {});
if unlimited_jids:empty() then
return;
end
module:hook("authentication-success", function (event)
local session = event.session;
local jid = session.username .. "@" .. session.host;
if unlimited_jids:contains(jid) then
if session.conn and session.conn.setlimit then
session.conn:setlimit(0);
elseif session.throttle then
session.throttle = nil;
end
end
end);