Diff

plugins/mod_s2s.lua @ 13110:d5f322dd424b 0.12

mod_s2s: Add event where resolver for s2sout can be tweaked Could be used to implement custom connection methods (c.f. mod_onions) without needing to duplicate the rest of route_to_new_session(). Adds a feature to enable detection since it can be difficult to detect support for an event otherwise.
author Kim Alvefur <zash@zash.se>
date Thu, 18 Aug 2022 03:26:32 +0200
parent 12679:7d4a95ba9b6c
child 13111:8576f94ac90a
line wrap: on
line diff
--- a/plugins/mod_s2s.lua	Mon May 01 15:10:32 2023 +0200
+++ b/plugins/mod_s2s.lua	Thu Aug 18 03:26:32 2022 +0200
@@ -230,6 +230,10 @@
 			resolver;
 		});
 	end
+
+	local pre_event = { session = host_session; resolver = resolver };
+	module:context(from_host):fire_event("s2sout-pre-connect", pre_event);
+	resolver = pre_event.resolver;
 	connect(resolver, listener, nil, { session = host_session });
 	m_initiated_connections:with_labels(from_host):add(1)
 	return true;