Software /
code /
prosody
Annotate
plugins/mod_turn_external.lua @ 11632:21a1b9fb08a1
mod_admin_adhoc: Delete "Get User Password" command
This doesn't really make sense today. It doesn't even work with
mod_auth_internal_hashed, which should be the default. And even with a
supporting authentication module, why would we just hand out the
password? One use case may be to recover a forgotten password. While not
yet included with Prosody, there are better ways to handle forgotten
passwords, usually by resetting them to a new password.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 27 Jun 2021 21:51:21 +0200 |
parent | 11599:ed405b6357a8 |
child | 12282:fe5a87b5972f |
rev | line source |
---|---|
11599
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local secret = module:get_option_string("turn_external_secret"); |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 local host = module:get_option_string("turn_external_host", module.host); |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 local user = module:get_option_string("turn_external_user"); |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 local port = module:get_option_number("turn_external_port", 3478); |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 local ttl = module:get_option_number("turn_external_ttl", 86400); |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 local services = module:get_option_set("turn_external_services", {"stun-udp"; "turn-udp"}); |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 if not secret then error("mod_" .. module.name .. " requires that 'turn_external_secret' be set") end |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 module:depends "external_services"; |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 for _, type in ipairs({"stun"; "turn"}) do |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 for _, transport in ipairs({"udp"; "tcp"}) do |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 if services:contains(type .. "-" .. transport) then |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 module:add_item("external_service", { |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 type = type; |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 transport = transport; |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 host = host; |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 port = port; |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 username = type == "turn" and user or nil; |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 secret = type == "turn" and secret or nil; |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 ttl = type == "turn" and ttl or nil; |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 }) |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 end |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 end |
ed405b6357a8
mod_turn_external: Simple module to offer TURN(+STUN) via mod_external_services
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 end |