Skip to content

Commit

Permalink
Remove RTCIceCredentialType (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
Serial-ATA committed Jun 29, 2024
1 parent a74b96d commit d6b1d34
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 102 deletions.
74 changes: 0 additions & 74 deletions webrtc/src/ice_transport/ice_credential_type.rs

This file was deleted.

26 changes: 2 additions & 24 deletions webrtc/src/ice_transport/ice_server.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use serde::{Deserialize, Serialize};

use crate::error::{Error, Result};
use crate::ice_transport::ice_credential_type::RTCIceCredentialType;

/// ICEServer describes a single STUN and TURN server that can be used by
/// the ICEAgent to establish a connection with a peer.
Expand All @@ -10,7 +9,6 @@ pub struct RTCIceServer {
pub urls: Vec<String>,
pub username: String,
pub credential: String,
pub credential_type: RTCIceCredentialType,
}

impl RTCIceServer {
Expand All @@ -34,23 +32,9 @@ impl RTCIceServer {
if self.username.is_empty() || self.credential.is_empty() {
return Err(Error::ErrNoTurnCredentials);
}
url.username.clone_from(&self.username);

match self.credential_type {
RTCIceCredentialType::Password => {
// https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.3)
url.password.clone_from(&self.credential);
}
RTCIceCredentialType::Oauth => {
// https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.4)
/*if _, ok: = s.Credential.(OAuthCredential); !ok {
return nil,
&rtcerr.InvalidAccessError{Err: ErrTurnCredentials
}
}*/
}
_ => return Err(Error::ErrTurnCredentials),
};
url.username.clone_from(&self.username);
url.password.clone_from(&self.credential);
}

urls.push(url);
Expand All @@ -72,7 +56,6 @@ mod test {
urls: vec!["turn:192.158.29.39?transport=udp".to_owned()],
username: "unittest".to_owned(),
credential: "placeholder".to_owned(),
credential_type: RTCIceCredentialType::Password,
},
true,
),
Expand All @@ -81,7 +64,6 @@ mod test {
urls: vec!["turn:[2001:db8:1234:5678::1]?transport=udp".to_owned()],
username: "unittest".to_owned(),
credential: "placeholder".to_owned(),
credential_type: RTCIceCredentialType::Password,
},
true,
),
Expand Down Expand Up @@ -117,7 +99,6 @@ mod test {
urls: vec!["turn:192.158.29.39?transport=udp".to_owned()],
username: "unittest".to_owned(),
credential: String::new(),
credential_type: RTCIceCredentialType::Password,
},
Error::ErrNoTurnCredentials,
),
Expand All @@ -126,7 +107,6 @@ mod test {
urls: vec!["turn:192.158.29.39?transport=udp".to_owned()],
username: "unittest".to_owned(),
credential: String::new(),
credential_type: RTCIceCredentialType::Oauth,
},
Error::ErrNoTurnCredentials,
),
Expand All @@ -135,7 +115,6 @@ mod test {
urls: vec!["turn:192.158.29.39?transport=udp".to_owned()],
username: "unittest".to_owned(),
credential: String::new(),
credential_type: RTCIceCredentialType::Unspecified,
},
Error::ErrNoTurnCredentials,
),
Expand All @@ -157,7 +136,6 @@ mod test {
urls: vec!["stun:google.de?transport=udp".to_owned()],
username: "unittest".to_owned(),
credential: String::new(),
credential_type: RTCIceCredentialType::Oauth,
},
ice::Error::ErrStunQuery,
)];
Expand Down
1 change: 0 additions & 1 deletion webrtc/src/ice_transport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pub mod ice_candidate;
pub mod ice_candidate_pair;
pub mod ice_candidate_type;
pub mod ice_connection_state;
pub mod ice_credential_type;
pub mod ice_gatherer;
pub mod ice_gatherer_state;
pub mod ice_gathering_state;
Expand Down
3 changes: 0 additions & 3 deletions webrtc/src/peer_connection/peer_connection_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::api::interceptor_registry::register_default_interceptors;
use crate::api::media_engine::{MediaEngine, MIME_TYPE_VP8};
use crate::api::APIBuilder;
use crate::ice_transport::ice_candidate_pair::RTCIceCandidatePair;
use crate::ice_transport::ice_credential_type::RTCIceCredentialType;
use crate::ice_transport::ice_server::RTCIceServer;
use crate::peer_connection::configuration::RTCConfiguration;
use crate::rtp_transceiver::rtp_codec::RTCRtpCodecCapability;
Expand Down Expand Up @@ -408,7 +407,6 @@ async fn test_set_get_configuration() {
urls: vec!["stun:stun.l.google.com:19302".to_string()],
username: "".to_string(),
credential: "".to_string(),
credential_type: RTCIceCredentialType::Unspecified,
}],
..Default::default()
};
Expand Down Expand Up @@ -448,7 +446,6 @@ async fn test_set_get_configuration() {
],
username: "live777".to_string(),
credential: "live777".to_string(),
credential_type: RTCIceCredentialType::Password,
}],
..Default::default()
};
Expand Down

0 comments on commit d6b1d34

Please sign in to comment.