aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-02-10 15:39:15 +0100
committerKim Alvefur <zash@zash.se>2022-02-10 15:39:15 +0100
commitd92ceb3adb759e3bc686709c5b7f4c92d10565c4 (patch)
treefd5ec3a8654aee2204a0704a25ba1ecb76773b2d /plugins
parentfd5a0f6a063677e35863589ad6980e1178d38746 (diff)
downloadprosody-d92ceb3adb759e3bc686709c5b7f4c92d10565c4.tar.gz
prosody-d92ceb3adb759e3bc686709c5b7f4c92d10565c4.zip
mod_turn_external: Simplify configuration
Much harder to get boolean options wrong than accidentally adding something unrecognised to a Set.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_turn_external.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/mod_turn_external.lua b/plugins/mod_turn_external.lua
index 63b36175..a064d58b 100644
--- a/plugins/mod_turn_external.lua
+++ b/plugins/mod_turn_external.lua
@@ -1,13 +1,20 @@
+local set = require "util.set";
+
local secret = module:get_option_string("turn_external_secret");
local host = module:get_option_string("turn_external_host", module.host);
local user = module:get_option_string("turn_external_user");
local port = module:get_option_number("turn_external_port", 3478);
local ttl = module:get_option_number("turn_external_ttl", 86400);
-
-local services = module:get_option_set("turn_external_services", {"stun-udp"; "turn-udp"});
+local tcp = module:get_option_boolean("turn_external_tcp", false);
if not secret then error("mod_" .. module.name .. " requires that 'turn_external_secret' be set") end
+local services = set.new({ "stun-udp"; "turn-udp" });
+if tcp then
+ services:add("stun-tcp");
+ services:add("turn-tcp");
+end
+
module:depends "external_services";
for _, type in ipairs({"stun"; "turn"}) do