@muxion/libp2p-webrtc-js
v0.3.0
Published
WebRTC DataChannel support for the Muxion libp2p transport.
Readme
@muxion/libp2p-webrtc-js
WebRTC DataChannel support for the Muxion libp2p transport.
The package supports two connection paths:
createFluxmuxWebRtcRelayDrivercreates a driver for the libp2p private-to-private design. It exchanges SDP on a Circuit Relay stream, then removes the relay from the data path.createFluxmuxWebRtcDrivercreates a driver for application-supplied direct signaling.
Both paths use the distinct /fluxmux-webrtc multiaddr protocol because the
Muxion channel wire format is not the standard libp2p WebRTC format.
The reserved channel carries one complete Muxion packet per SCTP message. It uses these options:
{
id: 0,
negotiated: true,
ordered: false,
maxRetransmits: 0,
protocol: 'fluxmux/1.0.0',
}Muxion supplies authentication, reliable streams, flow control, loss repair, and multiplexing. Therefore, this channel does not run the standard libp2p Noise framing or create one DataChannel per application stream.
Relay signaling uses /fluxmux/webrtc-signaling/1.0.0. It does not use the
standard libp2p signaling protocol because the resulting data channel is not a
standard libp2p WebRTC connection. The driver collects all ICE candidates in
the offer or answer SDP before it sends the description.
Relay-assisted addresses have this form:
<relay-address>/p2p-circuit/fluxmux-webrtc/p2p/<destination-peer-id>The direct signaling implementation must complete SDP and ICE and validate the advertised SHA-256 certificate hash. It must return the local and remote SHA-256 DTLS certificate fingerprints as multihash bytes. Both drivers order the fingerprints by Muxion handshake role and bind them into the Noise transcript.
The browser integration test starts a real libp2p Circuit Relay server, makes relay reservations for two browser nodes, establishes a direct Muxion WebRTC connection, and exchanges an application stream in Chromium.
