Changeset

5634:6fb93b901aa4

Merge upstream
author Trần H. Trung <xmpp:trần.h.trung@trung.fun>
date Sat, 29 Jul 2023 18:11:24 +0700
parents 5633:758866b43aa4 (current diff) 5632:ae62d92506dc (diff)
children 5635:99c0e675b969
files
diffstat 3 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_invites_page/mod_invites_page.lua	Sat Jul 29 18:08:58 2023 +0700
+++ b/mod_invites_page/mod_invites_page.lua	Sat Jul 29 18:11:24 2023 +0700
@@ -39,6 +39,9 @@
 		else
 			http_files = module:depends"http_files";
 		end
+	elseif prosody.process_type and module.get_option_period then
+		module:depends("http");
+		http_files = require "net.http.files";
 	end
 	-- Calculate automatic base_url default
 	base_url = module.http_url and module:http_url();
--- a/mod_s2sout_override/README.md	Sat Jul 29 18:08:58 2023 +0700
+++ b/mod_s2sout_override/README.md	Sat Jul 29 18:11:24 2023 +0700
@@ -18,6 +18,13 @@
 URIs with IP addresses like `tcp://127.0.0.1:9999` will bypass A/AAAA
 DNS lookups.
 
+The special target `"*"` may be used to redirect all servers that don't have
+an exact match.
+
+One-level wildcards like `"*.example.net"` also work.
+
+Standard DNS SRV resolution can be restored by specifying a truthy value.
+
 ```lua
 -- Global section
 modules_enabled = {
@@ -28,7 +35,13 @@
 s2sout_override = {
     ["example.com"] = "tcp://other.host.example:5299";
     ["xmpp.example.net"] = "tcp://localhost:5999";
-    ["secure.example"] = = "tls://127.0.0.1:5270";
+    ["secure.example"] = "tls://127.0.0.1:5270";
+    ["*.allthese.example"] = = "tcp://198.51.100.123:9999";
+
+    -- catch-all:
+    ["*"] = "tls://127.0.0.1:5370";
+    -- bypass the catch-all, use standard DNS SRV:
+    ["jabber.example"] = true;
 }
 ```
 
--- a/mod_s2sout_override/mod_s2sout_override.lua	Sat Jul 29 18:08:58 2023 +0700
+++ b/mod_s2sout_override/mod_s2sout_override.lua	Sat Jul 29 18:11:24 2023 +0700
@@ -6,7 +6,7 @@
 local override_for = module:get_option(module.name, {}); -- map of host to "tcp://example.com:5269"
 
 module:hook("s2sout-pre-connect", function(event)
-	local override = override_for[event.session.to_host];
+	local override = override_for[event.session.to_host] or override_for[event.session.to_host:gsub("^[^.]+%.", "*.")] or override_for["*"];
 	if type(override) == "string" then
 		override = url.parse(override);
 	end