1
1
use serde:: { Deserialize , Serialize } ;
2
2
3
3
use crate :: error:: { Error , Result } ;
4
- use crate :: ice_transport:: ice_credential_type:: RTCIceCredentialType ;
5
4
6
5
/// ICEServer describes a single STUN and TURN server that can be used by
7
6
/// the ICEAgent to establish a connection with a peer.
@@ -10,7 +9,6 @@ pub struct RTCIceServer {
10
9
pub urls : Vec < String > ,
11
10
pub username : String ,
12
11
pub credential : String ,
13
- pub credential_type : RTCIceCredentialType ,
14
12
}
15
13
16
14
impl RTCIceServer {
@@ -34,23 +32,9 @@ impl RTCIceServer {
34
32
if self . username . is_empty ( ) || self . credential . is_empty ( ) {
35
33
return Err ( Error :: ErrNoTurnCredentials ) ;
36
34
}
37
- url. username . clone_from ( & self . username ) ;
38
35
39
- match self . credential_type {
40
- RTCIceCredentialType :: Password => {
41
- // https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.3)
42
- url. password . clone_from ( & self . credential ) ;
43
- }
44
- RTCIceCredentialType :: Oauth => {
45
- // https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.4)
46
- /*if _, ok: = s.Credential.(OAuthCredential); !ok {
47
- return nil,
48
- &rtcerr.InvalidAccessError{Err: ErrTurnCredentials
49
- }
50
- }*/
51
- }
52
- _ => return Err ( Error :: ErrTurnCredentials ) ,
53
- } ;
36
+ url. username . clone_from ( & self . username ) ;
37
+ url. password . clone_from ( & self . credential ) ;
54
38
}
55
39
56
40
urls. push ( url) ;
@@ -72,7 +56,6 @@ mod test {
72
56
urls: vec![ "turn:192.158.29.39?transport=udp" . to_owned( ) ] ,
73
57
username: "unittest" . to_owned( ) ,
74
58
credential: "placeholder" . to_owned( ) ,
75
- credential_type: RTCIceCredentialType :: Password ,
76
59
} ,
77
60
true ,
78
61
) ,
@@ -81,7 +64,6 @@ mod test {
81
64
urls: vec![ "turn:[2001:db8:1234:5678::1]?transport=udp" . to_owned( ) ] ,
82
65
username: "unittest" . to_owned( ) ,
83
66
credential: "placeholder" . to_owned( ) ,
84
- credential_type: RTCIceCredentialType :: Password ,
85
67
} ,
86
68
true ,
87
69
) ,
@@ -117,7 +99,6 @@ mod test {
117
99
urls: vec![ "turn:192.158.29.39?transport=udp" . to_owned( ) ] ,
118
100
username: "unittest" . to_owned( ) ,
119
101
credential: String :: new( ) ,
120
- credential_type: RTCIceCredentialType :: Password ,
121
102
} ,
122
103
Error :: ErrNoTurnCredentials ,
123
104
) ,
@@ -126,7 +107,6 @@ mod test {
126
107
urls: vec![ "turn:192.158.29.39?transport=udp" . to_owned( ) ] ,
127
108
username: "unittest" . to_owned( ) ,
128
109
credential: String :: new( ) ,
129
- credential_type: RTCIceCredentialType :: Oauth ,
130
110
} ,
131
111
Error :: ErrNoTurnCredentials ,
132
112
) ,
@@ -135,7 +115,6 @@ mod test {
135
115
urls: vec![ "turn:192.158.29.39?transport=udp" . to_owned( ) ] ,
136
116
username: "unittest" . to_owned( ) ,
137
117
credential: String :: new( ) ,
138
- credential_type: RTCIceCredentialType :: Unspecified ,
139
118
} ,
140
119
Error :: ErrNoTurnCredentials ,
141
120
) ,
@@ -157,7 +136,6 @@ mod test {
157
136
urls: vec![ "stun:google.de?transport=udp" . to_owned( ) ] ,
158
137
username: "unittest" . to_owned( ) ,
159
138
credential: String :: new( ) ,
160
- credential_type: RTCIceCredentialType :: Oauth ,
161
139
} ,
162
140
ice:: Error :: ErrStunQuery ,
163
141
) ] ;
0 commit comments