aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-09-07 11:26:42 +0100
committerMatthew Wild <mwild1@gmail.com>2022-09-07 11:26:42 +0100
commitb4ed12096371bb9224311b95a36a13280829e46b (patch)
tree9c17275a20b9a0397c10b82479d0e18f3685f27f
parentc6b7b011c0bc2f18ea9be6cf2cf62004d326d1a0 (diff)
downloadprosody-b4ed12096371bb9224311b95a36a13280829e46b.tar.gz
prosody-b4ed12096371bb9224311b95a36a13280829e46b.zip
portmanager: Expose API to get at SSL/TLS config for a given interface/port
-rw-r--r--core/portmanager.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/portmanager.lua b/core/portmanager.lua
index c9b90fd7..904c979c 100644
--- a/core/portmanager.lua
+++ b/core/portmanager.lua
@@ -219,6 +219,13 @@ function get_service_at(interface, port)
return data.service, data.server;
end
+local function get_tls_config_at(interface, port)
+ local data = active_services:search(nil, interface, port);
+ if not data or not data[1] or not data[1][1] then return nil, "not-found"; end
+ data = data[1][1];
+ return data.tls_cfg;
+end
+
local function get_service(service_name)
return (services[service_name] or {})[1];
end
@@ -310,6 +317,7 @@ return {
unregister_service = unregister_service;
close = close;
get_service_at = get_service_at;
+ get_tls_config_at = get_tls_config_at;
get_service = get_service;
get_active_services = get_active_services;
get_registered_services = get_registered_services;