Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebRTC transport support #698

Open
Menduist opened this issue Mar 2, 2022 · 3 comments
Open

WebRTC transport support #698

Menduist opened this issue Mar 2, 2022 · 3 comments

Comments

@Menduist
Copy link
Contributor

Menduist commented Mar 2, 2022

Issue to track what's needed to support the WebRTC transport (aka libp2p-webrtc-direct)

Transport protocols

The WebRTC stack:

RTCPeerConnection DataChannel
SRTP SCTP
DTLS DTLS
UDP UDP

My understanding is that we only need DataChannel for the transport to work properly.
UDP: already implemented in chronos
DTLS: BearSSL doesn't implement it yet. Track progress here. After it's done (or maybe we can hack it together), chronos implementation should be relatively trivial (~300 LoC)
SCTP over DTLS: need a user-space library (linux has a native implem of SCTP over IP or UDP, not over DTLS). Complexity: probably similar to Quic
DataChannel: Should be pretty straightforward (~200 LoC)

Overall, probably >3 months of work.

Repo: https:/status-im/nim-webrtc

@mxinden
Copy link

mxinden commented Mar 4, 2022

(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 (libp2p/specs#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.

@lchenut
Copy link
Collaborator

lchenut commented Aug 29, 2022

We dig a bit on the SCTP part with @Menduist lately, here what we found:

  • There's no native implementation for the SCTP in nim that we could use, https:/metacontainer/sctp.nim is the only one we found, it's not maintained and use reactor instead of chronos as an asynchronous library. However, it imports a C library that looks promising.
  • The C implementation used by sctp.nim is https:/sctplab/usrsctp, it's well maintained, it's importable, it looks usable for our purpose. Not much more to say. I'll check if it's easily feasible soon.
  • The other option is to implement our own version of SCTP, looking at the pion implementation in Go (~5500 LoC), it shouldn't be too long to code.

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.

@Menduist Menduist mentioned this issue Sep 27, 2022
21 tasks
@lchenut
Copy link
Collaborator

lchenut commented Dec 30, 2022

A quick overview of what was done since last update.

  • The SCTP is more or less done. I wrappped the https:/sctplab/usrsctp library. It needs a more testing and tweaking but beside that, the wrapping is done. You can take a look at it here.
  • As for DTLS part, BearSSL still doesn't implement it. It might be a good idea to take a look at other implementations.
  • The DataChannel is the next thing I'll look at, assuming it doesn't need DTLS features to work

Some DataChannel relevant links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

No branches or pull requests

3 participants