Condense collaboration procedures, protocol field inventories and repeated audit or experiment narration into their existing owners. Keep accepted decisions, unresolved work, primary sources and measurement limits. Detailed historical trials remain accessible at their measured Git revision without a second archive tree. Align both language guides with the existing contribution value criteria. Keep local operating instructions out of public contributor guidance. Independent reviews preserved closed baseline choices and single-run evidence limits. Documentation and repository hygiene checks pass; this phase changes no runtime code.
33 KiB
Browser And Native NAT Traversal
Last reviewed: 2026-11-28
This document owns evidence and its limits. Current 3.0 behavior belongs to the network model, execution methods to the laboratory, and dependency pins to Native provenance. The historical section links to the released Go/Pion/LiveKit evidence. An isolated candidate is not a delivered product feature. Detailed historical trials remain in the record at c4e55b99.
Confirmed Boundaries
- STUN exposes a socket's mapped address to ICE. It carries no media; its operator sees source address/port, request timing and protocol metadata.
- Reachable STUN destinations, accepted candidate syntax, authenticated checks, nomination and decoded media are different observations. None substitutes for the next. Browser gathering can deduplicate equal mappings or finish after a useful candidate has already arrived.
- Mapping samples do not establish filtering behavior or a persistent NAT type. Source ports, destination IPs, interfaces and network changes affect the result.
- Ordinary Browser WebRTC owns its sockets. A page cannot open an arbitrary UDP pool or replace ICE with a Native QUIC/WireGuard hole-punching socket.
- Direct reachability, relay coverage, setup latency and recovery are separate outcomes. Controlled success counts are not public-network success rates.
ICE Recovery Boundaries
Piik owns current-pair authorization, negotiation and candidate generations; the RTC framework owns checks, nomination and media adaptation. Stale signaling must not mutate a replacement, and a failure already handled by the current operation must not create a second restart. Increasing retry counts does not repair those ownership defects. Current Rust behavior is described below; ordinary recovery retains the distinct 2.x findings. Names of libraries or packaged classes do not prove active relay use.
Rust Integration
The network model defines Native UDP preparation, its socket and request budgets, and ordinary ICE fallback.
For stable/sequential observations, the stable side retains its survey socket.
The bounded targets are last + 4*step and last + 8*step; authentication fixes
one peer tuple. Matching transaction responses and mutual completion precede
socket transfer. The ICE triggered-check principle
lets an authenticated incoming request trigger the local check while that owner
continues answering. Initial and triggered requests share the finite budget.
Controlled results establish these separate improvements:
- A one-second signaling skew plus a lost first triggered request completed within the existing five-second preparation lifetime.
- Four intervening allocations defeated the single predicted target; the bounded alternative connected and carried advancing picture and sound with fewer requests. This covers one stable/sequential allocation-drift model.
- TCP-header controls isolated approximately 0.94 seconds of additional Ping/ACK skew. Disabling Nagle through existing Native/App/Domain socket APIs removed that component without removing the injected network delay.
- With three delayed STUN destinations, issuing the observations concurrently reduced survey and signaling time while preserving their original send order.
- Under sequential mapping with address-and-port-dependent filtering (APDF), retaining the existing RTC connected sooner than replacing it. Both paths carried decoded video, audio and a verified file.
- Two Native RTCs initially using coturn moved decoded video to the authenticated prepared tuple while keeping their credentials, DTLS and DataChannel. Withholding the prepared socket kept traffic on TURN.
The adapter also translates the selected ICE implementation's terminal boundary.
The reviewed is 0.11.1 source
emits Disconnected when no nominated or viable candidate remains, with no later
Failed event; its default unanswered-check budget was about 21.5 seconds.
Native lets the SDK's send-consent gate determine when an established path retires. Browser
disconnection retains Browser semantics, and short interruptions remain SDK-owned.
Allocator Prediction Controls
Linux namespace controls varied where unrelated allocations fell relative to the peer's allocations. Bidirectional UDP reached different targets accordingly.
| Allocation sequence | Existing search | Candidate search |
|---|---|---|
| Four foreign allocations before each side's eight mappings | Target +4 missed |
Target +8 reached both peers |
| Four foreign allocations between each side's fourth and fifth mappings | Target +4 reached both peers |
Target +8 missed |
| Stable/sequential, twelve foreign allocations before the sequential side | Eight sockets and two targets missed | One socket and 64 targets reached both peers |
Searching 64 targets from a retained socket created 64 peer-directed tracking entries. The production request budget also covers triggered checks.
A same-socket STUN census across three IPs and two ports distinguished port preservation, address-dependent mapping and sequential per-flow mapping in programmed routers. The next two peer mappings fell outside the observed port range. Prediction accuracy requires held-out peer mappings, including missing observations. Filtering requires its own measurement. RFC 4787
With a stable peer and a sequential or four-counter tuple-hashed allocator, ten targets chosen before contacting the peer carried bidirectional synthetic UDP within a 64-datagram budget. Sending only to the advertised port failed in both controls. These experiments ended at UDP delivery.
Native NAT64 Assessment
Native adds IPv6 aliases for numeric IPv4 UDP candidates through the SDK's public
API. One connection-scoped lookup of ipv4only.arpa discovers the prefix under
RFC 7050; synthesis follows
the six RFC 6052 layouts.
Initial ICE starts discovery once it has both a non-loopback IPv6 base and an
IPv4 peer candidate. Desktop interface refresh watches both bound address
families until ICE nomination. Newly available IPv4 bases also reach the shared
gateway publisher. A monitor-injection control published a late IPv4 candidate
and admitted one injected gateway mapping to both connections sharing its socket.
Interface refresh can supply the first usable IPv6
base after gathering starts. First ICE nomination or pair retirement releases
bootstrap work. Failed discovery or exhausted aliases preserve
ordinary candidates. There is no persistent prefix cache or SDK fork. Well-known
prefix synthesis is limited to global IPv4; network-specific prefixes retain
private-address support.
An isolated network-specific /64 control delayed DNS64 and used real NAT64
translation. Ordinary ICE nominated the path; room/file/input DataChannels opened,
and picture and sound advanced through an IPv6-only Native relay. Other prefix
lengths have RFC-vector coverage. Physical networks, multiple translators and
interface changes remain outside this evidence; status owns the
delivered-package snapshot.
Random-Mapping Collision Control
Current Native stable/irregular preparation constructs two intersecting sets: independent hard-side mappings toward one stable peer tuple, and distinct ports searched from that peer's retained socket. Repeating a single prediction does not construct this search space. Both-irregular observations retain ordinary ICE.
For M independent uniform mapping draws and N distinct targets in an effective
port pool R, the idealized hit probability is
1 - (1 - N/R)^M ≈ 1 - exp(-M*N/R). If both sets are sampled without replacement,
the exact hit probability is 1 - ∏(1 - N/(R-i)) for i=0..M-1.
With M=N=256 and R=65535, the exponential approximation
is about 63.2%, not near certainty. Piik's target range 1024–65535 has 64,512 ports;
real NAT allocation, occupied mappings, filtering and packet timing need not be
independent or uniform. Request/reply counts are not distinct-target counts.
The original traversal analysis
distinguishes this one-hard-peer model from two independently random mappings.
On 2026-11-14, the isolated research implementation used 256 hard-side sockets and 256 pre-frozen targets in calibrated Linux kernel NAT; neither Native had a full-cone exception. Five fresh ordinary controls established no DataChannel within 30 seconds. Five matching experiments had three empty intersections and two natural authenticated matches. One carried decoded 640×360 video and audio through the original winner. Failed attempts sent 1,024 preparation datagrams per pair; successful attempts stopped at 582 and 308. The five-second preparation deadline stayed fixed; successful admission-to-DataChannel times were 8.51 and 8.11 seconds including the preceding ordinary attempt.
The production generator and matched Core22 then ran three fresh kernel-NAT trials: two DataChannels, one no-match deadline. The first success carried decoded media with SDK-selected tuple evidence. Separate deterministic resource controls observed 255 losing sockets released, the original winner retained, and all owned sockets released on pair withdrawal while the participant/signaling stayed alive. These establish mechanism and ownership, not a population success rate.
With 256 pool sockets, a 2 ms schedule and a five-second lifetime, increasing the search from 512 to 1,024 targets raised the number of mappings reached by mutual checks from 55 to 63 across 64 matched seeded SNAT/APDF mappings. No-hit traffic rose from 80 to 120 KiB per pair. A separate Rust preparation reached a mapping at target 586 and opened a DataChannel. Matched media controls carried video and audio under both budgets.
The survey and search share a deadline. If the survey consumes three seconds, the remaining window can accommodate about 745 checks.
The search divides ports 1,024–65,535 into 1,024 strata of 63 ports. It visits strata in bit-reversed order with a random rotation and draws an independent, uniform port within each stratum. Rejection sampling avoids modulo bias. This combines early range coverage with independent offsets, following stratified sampling. A single rotation of bit-reversed ports instead leaves the first 1,024 targets in one residue class modulo 32: fixed pools at strides 2, 4 and 8 are then missed for half, three quarters and seven eighths of rotations. Contiguous-pool tests alone do not reveal that blind spot.
The first 512 stratified targets leave at most 187 consecutive ports untested,
so they reach any fixed contiguous 256-port pool. For any fixed pool of 256
ports, the full-budget miss probability is at most (62/63)^256, about 1.664%,
under independent uniform draws. Uniform distinct targets miss about 1.650%.
These are static pool bounds, not unconditional dominance or field success rates.
Fixed 256-port loopback pools at strides 1, 2, 4 and 8 all completed mutual authentication and exchanged SCTP on the retained socket. This control exercised the search and handoff with a programmed allocator.
Default observations use three documented services on different destination ports: Cloudflare, Google and Nextcloud. Different ports can expose counter differences hidden by a common destination port. A local Windows sample received first-attempt IPv4 Binding replies from all three defaults and sixteen ports on one observer address. The actual UDP egress was unverified with a proxy and tunnel present. The sample establishes STUN availability on that machine's active path during the measurement.
A search window bounded by two counter observations remains experimental. The bounds imply containment only when the peer mappings use the same counter and public exit. Even with containment, interleaved allocation can leave gaps: in a 128-position window, eight mappings at even offsets 2 through 16 were all missed by 64 bit-reversed probes starting at offset 1, while the current sequential strategy's first target hit offset 4. Window selection and probe ordering need a matched two-sided comparison before replacing that strategy.
Native-to-Browser controls distinguish allocator behavior, candidate admission and media delivery.
| Controlled model | Result |
|---|---|
| Random destination-dependent mapping opposite a stable/APDF Browser | Ordinary ICE checked the observed addresses but failed with either one or eight Native sockets. Peer-facing mappings differed. |
| Sequential Native mapping opposite a stable Browser, both APDF | The predicted socket carried decoded H.264, advancing Opus and reverse RTCP in both media directions. Suppressing hypotheses left both controls disconnected. SDP roles differed across the reverse-direction comparison, which limits timing comparisons. |
| Address-dependent allocation | Three ports on one IP concealed the sequence. Three observer IPs exposed it and enabled bidirectional SCTP with either SDP offerer. Distinct hostnames alone do not guarantee distinct IPs. |
| Multiple Native IPv4 bases | A stable or silent first base left the second base eligible. Two qualifying bases yielded one batch from a single base. Only measured mappings entered the Native SDK as local candidates. |
The separate eight-socket pool experiments remain research candidates. Abrupt Browser closure in the media control did not establish retirement within its ten-second observation window.
Field Survey And Search Order
A one-sided survey covered 13 home, campus and mobile access networks in 35 runs. The survey included STUN observers on different IPs and, in later runs, sixteen ports on one observer IP. A separate beta.63 campus connection report lacked selected-pair evidence for attributing its success. Observer runbook
| What a network did | Networks |
|---|---|
| One mapping per socket whatever the destination, five of them keeping the local port | 8 |
| A counter for each destination, counting up by one | 2 (a campus, a carrier's hotspot) |
| One counter per public address for every destination, moving 300 to 550 ports a second | 1 (a hotspot with three addresses) |
| A few slow counters, or one block of some tens of ports, shared by all destinations | 3 |
Four of the thirteen left through more than one public address, chosen by destination or by socket. One hotspot is counted in two rows: its two addresses behaved differently.
On nine networks, a socket that sent only to the primary observer port received no response from the alternate port. An isolated direct-link control matched a valid alternate-port reply to its transaction. The field samples do not locate where those replies were lost.
Where each destination has its counter, the observer's sixteen ports showed what the public servers could not. Each even port and the odd one above it shared a counter, 14 of 14 pairs on the two networks. Of the mappings made toward one pair, 100 of 106 took the port after the last, across sockets and over twenty seconds, with no other traffic on those counters; the rest were jumps of a few ports or of one fixed size per network. On the campus a second run half an hour later continued most counters where the first had left them. Where a counter starts cannot be read from other destinations' counters: the held-out replay reached 1 to 4 of about 65. Counters of popular destinations move in bursts, since every subscriber's traffic to them shares one.
A simulation compared search orders using 256 pool sockets and 1,024 targets. For pools with consecutive ports, a bit-reversed search reached the pool in a median of 126 probes versus 166 for random targets. For a pool with stride four, a fixed bit-reversed order hit in 25.5% of 4,000 trials. Drawing independently within each stratum raised this to 98.9%. These results depend on the programmed pool. The static bounds and production order are given above.
A pool between two observations. Where one counter serves every destination, an observation just before the pool is made and one just after bound the pool's ports. With others taking 800 ports a second from the counter, twice what the hotspot showed, a pool of eight sockets was reached within 52 packets in 95 of 100 trials and within 123 in all; a pool of 64 within 28 in all.
A window-first search followed by a full-range search is an experimental alternative when observations bracket peer allocations on the same counter and public address. Its ordering still needs a matched two-sided comparison. Prior work describes sequential prediction, random probes against a socket pool and empirical carrier allocation patterns. Sequential prediction draft, pool analysis, carrier NAT measurements
On two multi-exit networks, Cloudflare and Google consistently observed different public IPs. On another multi-exit campus network, both observed the same IP in all four runs. The same-port defaults also produced apparently sequential mappings on a campus where peer destinations used separate counters. In this survey Cloudflare answered in 34 of 35 runs and Google in all 35. The third current default on UDP 443 was outside this field sample.
Concurrent STUN transactions preserved original send order for classification while receiving independently. With delayed replies and a dropped first request, the sequential control exhausted the 1.5-second window and concurrent observation completed within it. A slow DNS result can still arrive too late for a complete classification. On a split-route fixture, choosing the source for the actual STUN destination restored its return path and allowed the peer check to reuse the socket. The active OS route determines what that source can reach.
Partial observations describe the measured endpoints. A single reply or equal partial replies retain an unclassified endpoint. Two differing ports on one public IP support the irregular role. Three complete observations are required for sequential prediction. Conflicting mapped IPs end preparation, and a target-specific send error preserves other replies. RFC 5780 §4.3
In isolated kernel-NAT controls with destination filtering, a port-preserving peer missing its third STUN reply carried bidirectional SCTP and decoded VP8 with a fully observed sequential peer. With a random peer reporting two different ports, the search also carried SCTP and decoded VP8 from a retained endpoint measured by one or two replies. The matched baseline that treated both partial endpoints as unclassified delivered no frame in eight trials. The final one-reply and two-reply positive controls each ran once. Two partially observed sequential peers remained unreachable. If the retained endpoint's mapping varies toward the peer, the bounded search can exhaust its targets. Ordinary ICE keeps its independently gathered candidates.
External Forwarding And Participant Relays
The October 2026 frp v0.71.1 review established fixed-UDP forwarding feasibility, not an integrated Piik provider. A public HTTP/WebSocket entry does not forward dynamic media sockets. Current Server binding/public-address ownership belongs to the 3.0 network model.
- Keep STUN directly reachable. frp's UDP forwarder opens a local socket per remote endpoint, so backend STUN observes frpc rather than the participant. Piik's listener does not interpret Proxy Protocol.
- The UDP proxy frames datagrams into a work connection. Choosing QUIC does not make that path QUIC DATAGRAM or prove immunity to ordered-stream blocking.
- XTCP needs frpc on both endpoints. The reviewed VirtualNet was an Alpha TUN/client deployment, not an ordinary Browser invitation mechanism.
- Tailscale Peer Relays likewise need reachable, authorized participants. Bandwidth alone cannot qualify a relay; Piik accepts no second graph or App-hosted SFU from this comparison.
The historical 2.x direct/frp SFU control delivered at least 30 byte-identical VP8 frames and 30 Opus packets per subscriber, with reverse PLI and sibling retirement. The frp arm used TCP and blocked direct backend traffic. A paired STUN control confirmed the changed source mapping. This did not test Browser decode, audible audio, public performance, loss recovery or QUIC. Its fixed SFU recipe required matching external/local UDP ports; that is not the current Rust configuration.
Historical participant-relay controls also retained local voice mute isolation. A Pion-vnet Native relay retired a silent direct candidate, selected a friend and committed after 30 decoded VP8 frames with reverse PLI. Friend departure retired its resources; a new friend session recovered. These prove composition, not external reachability or a field success rate.
Iroh And Tailscale Comparison
Iroh's NAT guide estimates roughly nine-in-ten direct reachability; Tailscale reports above 90% in typical conditions. Neither is a matched before/after measurement against Piik. Keep these direct figures separate from relay fallback.
| Primary implementation | Reusable lesson; integration boundary |
|---|---|
| Tailscale v1.104.1 DISCO and endpoints | Coordinate outbound probes, authenticate transactions and expire endpoint observations. Piik already has current-pair signaling, ICE checks and connection-owned discovery; no parallel peer-address database is needed. |
| ICE peer-reflexive processing | ICE can learn endpoints different from advertised candidates. Preparation fixes one authenticated bounded tuple; accepting arbitrary reply ports would duplicate winner/nomination ownership. |
| libp2p DCUtR | Relative timing can synchronize sends. Measure RTT after both surveys; survey duration is not network RTT. Full Swarm/relay integration would duplicate Piik owners. |
| netwatch monitor | Reuse interface snapshots/change events through the existing pair owner, without a polling controller. |
| iroh 1.4.1, noq, Magicsock | Their QUIC/WireGuard traversal is not a drop-in Browser WebRTC socket. Piik already reuses lower-level noq-udp. Iroh's reviewed Browser path used relay traffic. |
Network-change work and Iroh's asymmetric repair justify checking freshness and both initiator roles. Comparisons must hold endpoint pairs, mapping/filtering, IPv6 and relay policy constant. The removed Go composition established cost and local feasibility, not a Browser-compatible reachability advantage.
Browser-Compatible Follow-Up
These are research boundaries, not accepted framework or protocol upgrades:
- The 2026 DCUtR paper measured 4.4 million attempts across more than 85,000 networks in December 2022–January 2023. Its roughly 70% success is conditional on relay reservation/address discovery; 97.6% of successful punches used the first attempt. Proposed role reversal and probabilistic search were future work, not measured improvements. Separate preparation failures from punch failures before copying retries.
- QUIC punching/migration reported latency benefits against its own TCP/re-punch controls. WebTransport is Browser-to-server, not arbitrary UDP; Direct Sockets requires an installed Isolated Web App.
- ICE renomination concerns path changes after connection. The historical Pion experiment below did not establish bidirectional stock-Browser interoperability; keep selection inside the framework rather than add a Piik path-selection loop.
- SPED overlaps ICE and DTLS establishment; WARP combines it with SCTP negotiation and DTLS 1.3. The July 2026 WARP model reduced media/data setup from six RTTs to two, with media at four RTTs in its baseline. This is handshake latency, not a new reachable NAT class. The reviewed Pion ICE v5 RC contained related work; draft expiry alone does not prove abandonment. Adoption still needs stable framework and negotiated stock-Browser support, not field flags or changed ICE consent.
Historical 2.x Evidence
The released v2.8.0 research record owns the Go/Pion/LiveKit measurements, including failed trials and experimental limits. ADR-0009 records the 2.x optional-prediction decision. v2.8.0 NAT research, ADR-0009
- Discovery and delivery controls cover STUN destination redundancy, Browser candidate deduplication and missing Viewer media behind Server NAT. Public-link discovery, Browser preflight, SFU behind NAT
- Native preparation controls cover same-socket STUN, gateway mapping and cancellation, selection attribution, and the limits of coordinated Go punching. Current 3.0 observations apply to one preparation. Shared-socket preflight, Gateway and survey limits, Observation and attribution, Rejected participant-wide NAT inference, Coordinated Native punching
- Browser interoperability controls cover mDNS, ordinary ICE restart and asymmetric recovery under experimental renomination. Stable Pion interoperability, Renomination preflight
The current 3.0 process controls exercise prepared and ordinary media over kernel NAT. Rust process controls
Integration Cost And Recovery Controls
The Go Magicsock composition required Native at both ends. The matched direct-transport comparison found the same reachability across the seven tested pairs. The historical record retains cold-start failure, package and memory cost, and feedback datagram limits. v2.8.0 Magicsock controls
Ordinary ICE And Media Recovery
The 2.x record covers the Browser bridge, generation handling, gateway and address-family controls, per-connection sockets and mapping cache lifetime. Ordinary ICE and media recovery, Mapping cache and retries, Connection sockets
Recovery Ownership And Forwarding
The 2.x controls distinguish input readiness, the parent recovery budget and fresh decoded pictures. The send-queue comparison covers the constrained-link and short-loss behavior. v2.8.0 recovery controls, Send-queue assessment
Routed Virtual LAN Discovery
The virtual-LAN trial covers local STUN and packaged-App firewall behavior. A separate control reproduced a path-MTU stall during startup resource transfer. Virtual-LAN discovery, Startup resource transfer
Native ICE Disconnection And Send Consent
In the pinned SDK control, suppressing STUN responses produced ICE disconnection after about 21.5 seconds. Restoring STUN while send consent remained valid recovered RTP and SCTP on the same RTC. After consent expired at 30 seconds, late checks on the old tuple did not restore delivery. Fresh credentials or another tuple did. Native uses the SDK's send authorization and expiry wakeup when deciding whether to keep an established connection. RFC 7675 §5.1
A G50 Browser–Native–Native–Browser chain with synthetic media kept its middle pair and continued decoding through short STUN loss. Prolonged loss retired the pair at consent expiry and a fresh path resumed video. A confirmed spare took over after decode proof when it had forwarding capacity.
Primary Sources
- RFC 8445: ICE
- RFC 4787: UDP NAT behavior
- RFC 5780: STUN behavior discovery
- Symmetric NAT prediction draft
- W3C WebRTC candidate model
- Chromium shared-socket STUN tests
- Tailscale mapping observations
- libp2p Browser/DCUtR boundary
- coturn endpoints
- Cloudflare STUN service
- Pion Universal UDP mux
- Pion dual-stack enumeration
- Go wildcard socket family selection
- Selected-candidate statistics
- Pinned 2.x NAT-PMP adapter
- NAT-PMP client calls