|
1 local set = require "util.set"; |
|
2 |
1 local secret = module:get_option_string("turn_external_secret"); |
3 local secret = module:get_option_string("turn_external_secret"); |
2 local host = module:get_option_string("turn_external_host", module.host); |
4 local host = module:get_option_string("turn_external_host", module.host); |
3 local user = module:get_option_string("turn_external_user"); |
5 local user = module:get_option_string("turn_external_user"); |
4 local port = module:get_option_number("turn_external_port", 3478); |
6 local port = module:get_option_number("turn_external_port", 3478); |
5 local ttl = module:get_option_number("turn_external_ttl", 86400); |
7 local ttl = module:get_option_number("turn_external_ttl", 86400); |
6 |
8 local tcp = module:get_option_boolean("turn_external_tcp", false); |
7 local services = module:get_option_set("turn_external_services", {"stun-udp"; "turn-udp"}); |
|
8 |
9 |
9 if not secret then error("mod_" .. module.name .. " requires that 'turn_external_secret' be set") end |
10 if not secret then error("mod_" .. module.name .. " requires that 'turn_external_secret' be set") end |
|
11 |
|
12 local services = set.new({ "stun-udp"; "turn-udp" }); |
|
13 if tcp then |
|
14 services:add("stun-tcp"); |
|
15 services:add("turn-tcp"); |
|
16 end |
10 |
17 |
11 module:depends "external_services"; |
18 module:depends "external_services"; |
12 |
19 |
13 for _, type in ipairs({"stun"; "turn"}) do |
20 for _, type in ipairs({"stun"; "turn"}) do |
14 for _, transport in ipairs({"udp"; "tcp"}) do |
21 for _, transport in ipairs({"udp"; "tcp"}) do |