aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/transport/__init__.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-10 22:12:59 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-10 22:12:59 +0200
commit60c4570e72e36c2a9720593c8baec74ee2ab52d6 (patch)
treee833e222a6a95e64e5b24a0813882636044198c2 /packages/meshbay-node/src/meshbay_node/transport/__init__.py
parent1a53eb4cc404ec94658fde0ae04cfe2ccf1810dc (diff)
downloadmeshbay-60c4570e72e36c2a9720593c8baec74ee2ab52d6.tar.gz
feat: Phase 9.1–9.5 — WebRTC DataChannel transport for browser P2P
Browser clients can now connect P2P to nodes behind residential NAT via WebRTC DataChannel with ICE/STUN. Validated on SFR Port-Restricted Cone NAT + 4G CGNAT across three scenarios (WiFi LAN, 4G IPv6, 4G IPv4 STUN). No TURN relay needed. Hub serves only as signaling relay (<1 KB). New files: - webrtc_server.py: aiortc-based WebRTC transport (node side) - signaling.py: SDP/ICE relay endpoint (hub side) - transport.js: browser WebRTC client with msgpack framing - webrtc-test.html: spike test page for browser→NAT→node validation - test_webrtc_transport.py: 4 tests (handshake, file transfer, auth, guard) - meshbay-draft-v4.md: architecture spec updated for web client Modified: - hub_client.py: WebRTC offer handling via hub WebSocket - revocation.py: node_id from WS auth + webrtc_answer routing - pyproject.toml: aiortc>=1.9 dependency 123 tests passing (117 existing + 6 new). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/transport/__init__.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/transport/__init__.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/transport/__init__.py b/packages/meshbay-node/src/meshbay_node/transport/__init__.py
index 5a1b8d7..df9c209 100644
--- a/packages/meshbay-node/src/meshbay_node/transport/__init__.py
+++ b/packages/meshbay-node/src/meshbay_node/transport/__init__.py
@@ -1,10 +1,9 @@
-"""MeshBay Node transport layer — TCP+TLS (MNP v1) and QUIC (MNP v2)."""
+"""MeshBay Node transport layer — TCP+TLS (v1), QUIC (v2), WebRTC (browsers)."""
from .server import ChunkServer
from .client import ChunkClient
from .http_server import create_http_app
# QUIC transport (MNP v2) — requires aioquic>=1.0
-# Falls back gracefully if not installed; node still works via TCP+TLS and HTTP.
try:
from .quic_server import QuicChunkServer, Denylist
from .quic_client import QuicChunkClient
@@ -15,7 +14,17 @@ except ImportError:
Denylist = None # type: ignore[assignment,misc]
QUIC_AVAILABLE = False
+# WebRTC transport (browsers) — requires aiortc>=1.9
+try:
+ from .webrtc_server import WebRTCTransport, WebRTCPeerSession
+ WEBRTC_AVAILABLE = True
+except ImportError:
+ WebRTCTransport = None # type: ignore[assignment,misc]
+ WebRTCPeerSession = None # type: ignore[assignment,misc]
+ WEBRTC_AVAILABLE = False
+
__all__ = [
"ChunkServer", "ChunkClient", "create_http_app",
"QuicChunkServer", "QuicChunkClient", "Denylist", "QUIC_AVAILABLE",
+ "WebRTCTransport", "WebRTCPeerSession", "WEBRTC_AVAILABLE",
]