Skip to main content

antenna_client_shared/
ice.rs

1const GOOGLE_STUN: &str = "stun:stun.l.google.com:19302";
2
3#[derive(Clone)]
4pub struct IceServerConfig {
5    pub urls: Vec<String>,
6    pub username: Option<String>,
7    pub credential: Option<String>,
8}
9
10impl IceServerConfig {
11    pub fn new(urls: Vec<String>) -> Self {
12        Self {
13            urls,
14            username: None,
15            credential: None,
16        }
17    }
18
19    pub fn with_credentials(urls: Vec<String>, username: String, credential: String) -> Self {
20        Self {
21            urls,
22            username: Some(username),
23            credential: Some(credential),
24        }
25    }
26
27    pub fn default_stun() -> Vec<Self> {
28        vec![Self::new(vec![GOOGLE_STUN.into()])]
29    }
30}