Skip to content

Commit e153905

Browse files
committed
feat: Use turn.delta.chat as fallback TURN server (#7382)
1 parent 3637fe6 commit e153905

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

src/calls.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,24 +660,35 @@ pub(crate) async fn create_fallback_ice_servers(context: &Context) -> Result<Str
660660
// because of bandwidth costs:
661661
// <https://github.com/jselbie/stunserver/issues/50>
662662

663-
// We use nine.testrun.org for a default STUN server.
664-
let hostname = "nine.testrun.org";
663+
let hostname = "turn.delta.chat";
664+
// Do not use cache because there is no TLS.
665+
let load_cache = false;
666+
let urls: Vec<String> = lookup_host_with_cache(context, hostname, STUN_PORT, "", load_cache)
667+
.await?
668+
.into_iter()
669+
.map(|addr| format!("turn:{addr}"))
670+
.collect();
671+
let turn_server = IceServer {
672+
urls,
673+
username: Some("public".to_string()),
674+
credential: Some("o4tR7yG4rG2slhXqRUf9zgmHz".to_string()),
675+
};
665676

677+
let hostname = "nine.testrun.org";
666678
// Do not use cache because there is no TLS.
667679
let load_cache = false;
668680
let urls: Vec<String> = lookup_host_with_cache(context, hostname, STUN_PORT, "", load_cache)
669681
.await?
670682
.into_iter()
671683
.map(|addr| format!("stun:{addr}"))
672684
.collect();
673-
674-
let ice_server = IceServer {
685+
let stun_server = IceServer {
675686
urls,
676687
username: None,
677688
credential: None,
678689
};
679690

680-
let json = serde_json::to_string(&[ice_server])?;
691+
let json = serde_json::to_string(&[turn_server, stun_server])?;
681692
Ok(json)
682693
}
683694

src/net/dns.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,13 @@ static DNS_PRELOAD: LazyLock<HashMap<&'static str, Vec<IpAddr>>> = LazyLock::new
417417
"mail.systemli.org",
418418
vec![IpAddr::V4(Ipv4Addr::new(93, 190, 126, 36))],
419419
),
420+
(
421+
"turn.delta.chat",
422+
vec![
423+
IpAddr::V4(Ipv4Addr::new(46, 224, 39, 230)),
424+
IpAddr::V6(Ipv6Addr::new(0x2a01, 0x4f8, 0xc014, 0x9593, 0, 0, 0, 1)),
425+
],
426+
),
420427
("testrun.org", vec![IpAddr::V4(Ipv4Addr::new(5, 1, 76, 52))]),
421428
(
422429
"nine.testrun.org",

0 commit comments

Comments
 (0)