Open Menduist opened 2 years ago
(aka libp2p-webrtc-direct)
Note that webrtc direct will likely not be promoted to the general libp2p WebRTC protocol, given that it requires a previous WebSocket connection to exchange the SDP.
The goal of the upcoming design (https://github.com/libp2p/specs/issues/220) is to not require a previous exchange.
Happy to expand on this in case you are planning on working on this any time soon.
We dig a bit on the SCTP part with @Menduist lately, here what we found:
As for the full webrtc stack, only two were satisfying, the google one in C++ and the pion one in Go. I'm not sure if we can use those directly though.
A quick overview of what was done since last update.
Some DataChannel relevant links:
WebRTC Stack Implementation for libp2p in Nim
This issue covers the current status of our WebRTC stack implementation in Nim for our libp2p project. Below is an overview of the protocols involved, progress so far, and details about what’s left to complete. This issue will serve as a reference for the team to continue the implementation and maintenance.
Overview
The WebRTC stack we’re building consists of five main protocols:
You can currently find all these protocols merged in this PR: https://github.com/vacp2p/nim-webrtc/pull/24
While some are fully implemented, others require additional work, especially around cross-platform stability and testing. Here’s a detailed look at the status of each protocol, what’s working, what isn’t, and areas needing follow-up.
Protocol Breakdown
1. UDP
nim-chronos
, a reliable library we already use widely, so no issues are anticipated here.2. STUN (NAT Traversal)
realm
ornonce
, are not included since they are unnecessary for our use case as far as I know.3. DTLS (Encryption)
c2nim
introduces several pain points:c2nim
if I remember correctly) is not always able to handle some C specificity, requiring portions of the code to be wrapped manually.4. SCTP (Reliable Data Transmission)
5. DataChannel
Summary
The WebRTC stack implementation is well underway, with STUN fully implemented and stable UDP handling through nim-chronos. Wrapping for DTLS (via Mbed-TLS) and SCTP (via Usrsctp) provides essential protocol support, but comes with challenges in maintenance and cross-platform compatibility. DataChannel is in place but needs further testing.