Up-to-date rust implementation of netcode
benny-n opened this issue · comments
Hi @gafferongames !
I have been working on a new, up-to-date (1.02) rust implementation of the protocol: https://github.com/benny-n/netcode
The existing rust versions by @vvanders' or @jaynus' were really helpful to me, both in practice and as a reference to my own rewrite, but it seems both of them are unmaintained. I plan to maintain and extend this one.
Unlike said versions, this one is not a fork but rather a "from scratch" implementation which to my opinion actually ended up being a bit closer to the original C implementation API-wise (e.g. recv
instead of next_event
to receive packets, callbacks instead of ServerEvent
/ClientEvent
, etc.).
Notable changes between this implementation and the others:
- Supports 24-byte random nonces for connection tokens as specified in version 1.02.
- Encryption is implemented with the
chacha20poly1305
crate, making this the first rust implementation that does not rely on libsodium, or any FFI at all. - Better error handling (effectively less
unwrap()
and more error types)
I can't currently release my version as a crate in crates.io, since it shares a name with @vvanders' version.
I could:
- Call it
netcode2
which avoids the name conflict, but could potentially confuse users(?) - Get owner rights to the
netcode
crate from @vvanders, and push mine as an updated version of the same crate.
Anyway, I would love it if you could include this implementation in your list.
Thanks!
I'm totally down with whatever you want to do. I'm not sure if @vvanders is maintaining the rust version actively, but if he is, or if he can't be contacted, then the netcode2 sounds fine to me. Thanks!