vacp2p / nim-libp2p

libp2p implementation in Nim
https://vacp2p.github.io/nim-libp2p/docs/
MIT License
251 stars 55 forks source link

WebRTC transport support #698

Open Menduist opened 2 years ago

Menduist commented 2 years ago

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

2. STUN (NAT Traversal)

3. DTLS (Encryption)

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.

mxinden commented 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.

lchenut commented 2 years ago

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.

lchenut commented 1 year ago

A quick overview of what was done since last update.

Some DataChannel relevant links: