From c206990eef70af8aca02d546360a577fb4fdd56e Mon Sep 17 00:00:00 2001 From: Torsten Flammiger Date: Sat, 18 Dec 2021 12:13:46 +0000 Subject: [PATCH 1/6] Add a small TURN read-me --- TURN.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 TURN.md diff --git a/TURN.md b/TURN.md new file mode 100644 index 0000000..9251283 --- /dev/null +++ b/TURN.md @@ -0,0 +1,33 @@ +# Setting up TURN/STURN + +If you run into problems while configuring Conduit to inform clients about TURN services, ask us in `#conduit:matrix.org` or [open an issue on GitLab](https://gitlab.com/famedly/conduit/-/issues/new). + + +## General instructions + +* This was tested against Conduit(Next), Coturn (Archlinux) and Element (Android) +* Build your own Conduit from source. It's dead simple to build. +* Use the NEXT branch as only this branch provides the necessary functionality. +* This documentation assumes you have a [Coturn server](https://github.com/coturn/coturn) up and runnig. See [here](https://github.com/matrix-org/synapse/blob/develop/docs/turn-howto.md) how to get it working with the reference implementation. It's almost the same with Conduit. + +## Add a few setting to your existing conduit.toml + +``` +# Coturn settings to inform the clients where to find a coturn server +# to enable Audio/Video calls + +# domain.tdl should match the REALM setting of coturn +# Adjust this as needed, If you have only one transport write it this way: +# turn_uris = ["turn:domain.tld?transport=tcp"] +turn_uris = ["turn:domain.tdl?transport=udp", "turn:domain.tld?transport=tcp"] + +# the value of static-auth-secret of your turnserver +turn_secret = "" + +# the default +turn_ttl = 86400 # 1 Day +``` + +## Apply setting + +Restart Conduit and enjoy audio and/or video call functionality from within Element. From 34fdb3c43baf7909269897554d92093e851ae1df Mon Sep 17 00:00:00 2001 From: Torsten Flammiger Date: Sat, 18 Dec 2021 12:18:32 +0000 Subject: [PATCH 2/6] Update TURN.md with infos about using username / password instead of the static turnserver secret --- TURN.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/TURN.md b/TURN.md index 9251283..847167c 100644 --- a/TURN.md +++ b/TURN.md @@ -26,6 +26,12 @@ turn_secret = "" # the default turn_ttl = 86400 # 1 Day + +# If you have your TURN server configured to use a username and password +# you can provide these information too. In this case comment out +# turn_secret above! +#turn_username = "" +#turn_password = "" ``` ## Apply setting From 68bdb6663e87ad20ad9075d67841e480ae554e03 Mon Sep 17 00:00:00 2001 From: Torsten Flammiger Date: Sat, 18 Dec 2021 12:20:04 +0000 Subject: [PATCH 3/6] Remove TURN.md help infos --- TURN.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/TURN.md b/TURN.md index 847167c..ca1e70a 100644 --- a/TURN.md +++ b/TURN.md @@ -1,8 +1,5 @@ # Setting up TURN/STURN -If you run into problems while configuring Conduit to inform clients about TURN services, ask us in `#conduit:matrix.org` or [open an issue on GitLab](https://gitlab.com/famedly/conduit/-/issues/new). - - ## General instructions * This was tested against Conduit(Next), Coturn (Archlinux) and Element (Android) From 4c1c6819ba001d30dccc80483a3e301b110bea5c Mon Sep 17 00:00:00 2001 From: Torsten Flammiger Date: Sat, 18 Dec 2021 21:37:12 +0100 Subject: [PATCH 4/6] Added an (untested) option to unregister an appservice previously added by calling register_appservice --- src/database/admin.rs | 4 ++++ src/database/appservice.rs | 10 ++++++++++ src/database/rooms.rs | 9 +++++++++ 3 files changed, 23 insertions(+) diff --git a/src/database/admin.rs b/src/database/admin.rs index 1e5c47c..0702bcd 100644 --- a/src/database/admin.rs +++ b/src/database/admin.rs @@ -12,6 +12,7 @@ use tracing::warn; pub enum AdminCommand { RegisterAppservice(serde_yaml::Value), + UnregisterAppservice(String), ListAppservices, SendMessage(RoomMessageEventContent), } @@ -96,6 +97,9 @@ impl Admin { AdminCommand::RegisterAppservice(yaml) => { guard.appservice.register_appservice(yaml).unwrap(); // TODO handle error } + AdminCommand::UnregisterAppservice(service_name) => { + guard.appservice.unregister_appservice(&service_name).unwrap(); // TODO: see above + } AdminCommand::ListAppservices => { if let Ok(appservices) = guard.appservice.iter_ids().map(|ids| ids.collect::>()) { let count = appservices.len(); diff --git a/src/database/appservice.rs b/src/database/appservice.rs index 7cc9137..41fd0b2 100644 --- a/src/database/appservice.rs +++ b/src/database/appservice.rs @@ -27,6 +27,16 @@ impl Appservice { Ok(()) } + /** + * Remove a appservice registration + * + * id is the name you send to register the service + */ + pub fn unregister_appservice(&self, service_name: &str) -> Result<()> { + self.id_appserviceregistrations.remove(service_name.as_bytes())?; + Ok(()) + } + pub fn get_registration(&self, id: &str) -> Result> { self.cached_registrations .read() diff --git a/src/database/rooms.rs b/src/database/rooms.rs index fb9ecbf..ddf0e52 100644 --- a/src/database/rooms.rs +++ b/src/database/rooms.rs @@ -1528,6 +1528,15 @@ impl Rooms { )); } } + "unregister_appservice" => { + if args.len() == 1 { + db.admin.send(AdminCommand::UnregisterAppservice(args[0].to_owned())); + } else { + db.admin.send(AdminCommand::SendMessage( + RoomMessageEventContent::text_plain("Invalid appservice identifier. Need a valid identifier string"), + )); + } + } "list_appservices" => { db.admin.send(AdminCommand::ListAppservices); } From 7dbf760f6bdd0e53e1773bbf97e6f08b77e5fa80 Mon Sep 17 00:00:00 2001 From: Torsten Flammiger Date: Sat, 18 Dec 2021 22:22:33 +0100 Subject: [PATCH 5/6] Remove typo and fix variable names --- src/database/appservice.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/database/appservice.rs b/src/database/appservice.rs index 41fd0b2..c49db10 100644 --- a/src/database/appservice.rs +++ b/src/database/appservice.rs @@ -28,9 +28,9 @@ impl Appservice { } /** - * Remove a appservice registration + * Remove an appservice registration * - * id is the name you send to register the service + * service_name is the name you send to register the service */ pub fn unregister_appservice(&self, service_name: &str) -> Result<()> { self.id_appserviceregistrations.remove(service_name.as_bytes())?; From 3d88d221177366ad6975677ba2a647d7405c9dbf Mon Sep 17 00:00:00 2001 From: Torsten Flammiger Date: Sun, 19 Dec 2021 17:29:28 +0100 Subject: [PATCH 6/6] Update APPSERVICES.md to include how to remove an appservice --- APPSERVICES.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/APPSERVICES.md b/APPSERVICES.md index 26c34cc..52edf04 100644 --- a/APPSERVICES.md +++ b/APPSERVICES.md @@ -40,6 +40,15 @@ appservice can send requests to the homeserver. You don't need to restart Conduit, but if it doesn't work, restarting while the appservice is running could help. +### Remove an appservice + +To remove an appservice go to your admin room and execute + +```@conduit:your.server.name: unregister_appservice ``` + +where `` is of course one of the output of `list_appservices`. + + ## Appservice-specific instructions ### Tested appservices