matchbox
matchbox copied to clipboard
Add ice auth support
- [x] expose api for setting authentication
- [x] native implementation
- [ ] wasm implementation
- [ ] should
credential
andusername
beString
orOption<String>
? - [ ] document new api
- [ ] implement
From
trait for new enum
Fixes #3
should credential and username be String or Option<String>?
Had a quick look, what about something like this?
impl Default for RtcIceServerConfig {
fn default() -> Self {
Self {
urls: vec![
"stun:stun.l.google.com:19302".to_string(),
//"stun:stun.johanhelsing.studio:3478".to_string(),
//"turn:stun.johanhelsing.studio:3478".to_string(),
],
credentials: Default::default(),
}
}
}
#[derive(Debug)]
pub struct RtcIcePasswordCredentials {
username: String,
credential: String,
}
#[derive(Debug)]
pub struct RtcIceOathCredentials {
//Todo
}
#[derive(Debug)]
pub enum RtcIceCredentials {
None,
Password(RtcIcePasswordCredentials),
Oauth(RtcIceOathCredentials),
}
impl Default for RtcIceCredentials {
fn default() -> Self {
RtcIceCredentials::None
}
}
Pushed my code as I had it lying around, note that target branch is turn-support
, not main
https://github.com/johanhelsing/matchbox/pull/38
WDYT about my suggestion over here? https://github.com/johanhelsing/matchbox/pull/38
@tedsteen I think this should be good to go now. I haven't tested it, though, as I don't have a turn server running. Would you mind testing both implementations with yours?
I've been using a hosted solution https://xirsys.com/ for my turn needs and I've tried the RtcIceCredentials::Password
on that and they work fine.
I've also tried the IceCredentials::None
and they still work :)
@tedsteen Thanks!
@tedsteen have you a working example of how to use a TURN server? I am currently trying to figure out how this works but I am a little lost and could need a reference point.
@tedsteen have you a working example of how to use a TURN server? I am currently trying to figure out how this works but I am a little lost and could need a reference point.
Hi! Here is an example where I use turn servers with credentials https://github.com/tedsteen/nes-bundler/blob/4df0f60cc1866547d5d553c66089bfc4f7c1263e/src/netplay/connecting_state.rs#L207
For the servers themselves I use a service https://xirsys.com They have a really nice free tier that will be enough for most of your needs for sure if you are using it for ggrs.
Thanks! I appreciate the fast reply. Yeah xirsys looks pretty good.