From 58db83c4d0db9e9e26a7a92a3cb069766f681b4d Mon Sep 17 00:00:00 2001 From: Ruben De Smet Date: Mon, 30 Sep 2024 14:57:19 +0200 Subject: [PATCH] Add get_turn_server_info --- libsignal-service/src/push_service.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libsignal-service/src/push_service.rs b/libsignal-service/src/push_service.rs index 4724ce81f..99ee2896f 100644 --- a/libsignal-service/src/push_service.rs +++ b/libsignal-service/src/push_service.rs @@ -314,6 +314,16 @@ pub enum VerificationTransport { Voice, } +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TurnServerInfo { + pub username: String, + pub password: String, + pub hostname: String, + pub urls: Vec, + pub urls_with_ips: Vec, +} + impl VerificationTransport { pub fn as_str(&self) -> &str { match self { @@ -1407,4 +1417,16 @@ pub trait PushService: MaybeSend { .await?; Ok(res) } + + async fn get_turn_server_info( + &mut self, + ) -> Result { + self.get_json( + Endpoint::Service, + "/v1/calling/relays", + &[], + HttpAuthOverride::NoOverride, + ) + .await + } }