Skip to content

Commit

Permalink
Add get_turn_server_info
Browse files Browse the repository at this point in the history
  • Loading branch information
rubdos committed Sep 30, 2024
1 parent 2327c23 commit 58db83c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libsignal-service/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
pub urls_with_ips: Vec<String>,
}

impl VerificationTransport {
pub fn as_str(&self) -> &str {
match self {
Expand Down Expand Up @@ -1407,4 +1417,16 @@ pub trait PushService: MaybeSend {
.await?;
Ok(res)
}

async fn get_turn_server_info(
&mut self,
) -> Result<TurnServerInfo, ServiceError> {
self.get_json(
Endpoint::Service,
"/v1/calling/relays",
&[],
HttpAuthOverride::NoOverride,
)
.await
}
}

0 comments on commit 58db83c

Please sign in to comment.