Software /
code /
prosody
Changeset
12282:fe5a87b5972f
mod_turn_external: Simplify configuration
Much harder to get boolean options wrong than accidentally adding
something unrecognised to a Set.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 10 Feb 2022 15:39:15 +0100 |
parents | 12281:9016071867d7 |
children | 12283:b5686debb497 |
files | plugins/mod_turn_external.lua |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_turn_external.lua Sun Feb 06 14:34:02 2022 +0100 +++ b/plugins/mod_turn_external.lua Thu Feb 10 15:39:15 2022 +0100 @@ -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