mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 21:36:30 +03:00
feat: Use turn.delta.chat as fallback TURN server (#7382)
This commit is contained in:
21
src/calls.rs
21
src/calls.rs
@@ -663,9 +663,7 @@ pub(crate) async fn create_fallback_ice_servers(context: &Context) -> Result<Str
|
|||||||
// because of bandwidth costs:
|
// because of bandwidth costs:
|
||||||
// <https://github.com/jselbie/stunserver/issues/50>
|
// <https://github.com/jselbie/stunserver/issues/50>
|
||||||
|
|
||||||
// We use nine.testrun.org for a default STUN server.
|
|
||||||
let hostname = "nine.testrun.org";
|
let hostname = "nine.testrun.org";
|
||||||
|
|
||||||
// Do not use cache because there is no TLS.
|
// Do not use cache because there is no TLS.
|
||||||
let load_cache = false;
|
let load_cache = false;
|
||||||
let urls: Vec<String> = lookup_host_with_cache(context, hostname, STUN_PORT, "", load_cache)
|
let urls: Vec<String> = lookup_host_with_cache(context, hostname, STUN_PORT, "", load_cache)
|
||||||
@@ -673,14 +671,27 @@ pub(crate) async fn create_fallback_ice_servers(context: &Context) -> Result<Str
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|addr| format!("stun:{addr}"))
|
.map(|addr| format!("stun:{addr}"))
|
||||||
.collect();
|
.collect();
|
||||||
|
let stun_server = IceServer {
|
||||||
let ice_server = IceServer {
|
|
||||||
urls,
|
urls,
|
||||||
username: None,
|
username: None,
|
||||||
credential: None,
|
credential: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let json = serde_json::to_string(&[ice_server])?;
|
let hostname = "turn.delta.chat";
|
||||||
|
// Do not use cache because there is no TLS.
|
||||||
|
let load_cache = false;
|
||||||
|
let urls: Vec<String> = lookup_host_with_cache(context, hostname, STUN_PORT, "", load_cache)
|
||||||
|
.await?
|
||||||
|
.into_iter()
|
||||||
|
.map(|addr| format!("turn:{addr}"))
|
||||||
|
.collect();
|
||||||
|
let turn_server = IceServer {
|
||||||
|
urls,
|
||||||
|
username: Some("public".to_string()),
|
||||||
|
credential: Some("o4tR7yG4rG2slhXqRUf9zgmHz".to_string()),
|
||||||
|
};
|
||||||
|
|
||||||
|
let json = serde_json::to_string(&[stun_server, turn_server])?;
|
||||||
Ok(json)
|
Ok(json)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user