Repository navigation
WebRTC direct: browsers join listed servers with no offer; the master is a list - #42
Merged
Merged
Conversation
…r is a list A browser builds this server's answer itself from the master's row (address, webrtc_port, dtls_fingerprint), the way libp2p's webrtc-direct does: its offer's ICE username and password are one random string R, and its first STUN request (USERNAME "R:R") reaches libdatachannel's IceUdpMuxListener on the WebRTC port (rtcw_direct_listen). Net/WebRtc.c reads bans, "server full" and the per-address limit (4 joining) on that request, before anything is made; rtcw_peer_create_direct then answers a synthetic offer (R as ufrag and password, the browser's address as its candidate, DTLS client) with R, not checking the browser's certificate (anyone may join a public server); the browser checks ours against the listed fingerprint. From there it is the same peer as before. The master's signalling is gone: no long poll, no /v1/answer, no master_answer/master_reject, the two lanes they used. Offers now come only from a match's room (Net/Room.c). The log shows the certificate's fingerprint. Checked with Chrome, Safari 27.3 and Firefox 153 (connection open in 56 to 194 ms, the 1.0 Greeting received) and with the game's own browser build; a wrong fingerprint fails, as it must.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #41 (base
feat/p2p-atyha): merge #41 first, then retarget this one to main.What: a browser joins a listed server by WebRTC direct (libp2p's webrtc-direct technique). It builds this server's SDP answer itself from the master's row (
identifier/identifier6,webrtc_port,dtls_fingerprint), with its own ICE ufrag = pwd = a randomR; the server recognises the first STUN request (USERNAME R:R) through libdatachannel'sIceUdpMuxListenerand makes the peer then. No offer goes through the master any more.RtcPeer.cpp:rtcw_direct_listen(the listener, events on the tick as everything else),rtcw_peer_create_direct(synthetic offer from R and the browser's address, answer with R viaLocalDescriptionInit,disableFingerprintVerification); peer creation shared with the room's offers.WebRtc.c: bans, server full and a per-address limit are read at the first STUN request, before anything is made (earlier than before); one peer per R however many times the browser repeats.Master.c: the long poll,/v1/answerandmaster_answer/master_rejectare gone (and their two lanes). The master only lists.Security: the browser checks the server's DTLS certificate against the listed fingerprint (a wrong one fails: tested); the server does not authenticate browsers, as before (anyone may join a public server).
Tested locally: Chrome, Safari 27.3, Firefox 153 (open in 56–194 ms, the 1.0 Greeting received), and the game's browser build joining a dedicated server (connect → joined in ~150 ms). Firefox does not use loopback ICE, so its test used the LAN address.
Pairs with the client PR and the master PR (row gets
webrtc_port, signalling routes removed). This PR runs CI.