Skip to content

spike: aiortc ICE mux / STUN USERNAME exposure for webrtc-direct v2 listener #1352

Description

@yashksaini-coder

Sub-spike of #546. Required before a spec-aligned /webrtc-direct listener can land.

Background

WebRTC-Direct v1 (libp2p/specs#672) and v2 (libp2p/specs#715) are no-signaling transports. The listener reconstructs the dialer's offer from the inbound STUN connectivity-check, reading the USERNAME attribute to recover ICE credentials and (for v2) the version-prefix dispatch (libp2p+webrtc+v1/ vs libp2p+webrtc+v2/).

js-libp2p solved this at the native ICE layer (murat-dogan/node-datachannel#420 exposes localUfrag on IceUdpMuxRequest). go-libp2p uses pion's ICE mux internals similarly.

py-libp2p uses aiortc. Whether aiortc gives us equivalent hooks is unknown today.

Goal

Determine — without committing to an implementation — whether aiortc exposes (or can be made to expose, via subclassing / monkey-patch / upstream PR):

  1. Inbound STUN parsing: the USERNAME attribute of incoming connectivity checks before/during ICE negotiation, so the listener can branch on the version-prefix and reconstruct the dialer's offer.
  2. Server-side credential override: setting local ufrag / pwd to the value parsed out of the STUN USERNAME before generating the answer (v2 step 6 in libp2p/specs#715).
  3. ICE mux / shared UDP socket across multiple concurrent inbound dials, so one listening UDP port can demux to per-dial RTCPeerConnections without spinning up a port per peer.

Deliverables

  • A spike doc (in this issue, a comment thread, or a short markdown PR) covering:
    • Which of the 3 capabilities aiortc currently exposes (public API, private-but-accessible, or genuinely absent).
    • For absent ones: feasibility of a subclass / monkey-patch / upstream contribution and a rough effort estimate.
  • A go / no-go recommendation: does py-libp2p WebRTC-Direct listener land on aiortc, or do we need a different ICE / DTLS backend (e.g. wrap a Rust / C library)?

Why this isn't blocking #1309

PR #1309 lands experimental v1 node-to-node scaffolding (HTTP POST /sdp signaling, documented as a py-to-py temporary harness). Browser dial and go / js interop are explicitly out of scope there; the STUN listener path is a separate piece of work this spike unblocks.

Refs #546, #1309.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions