* add external modules and patches
* migrate pion webrtc to vendored headlessclient, drop local pion replaces
* use chrome ice credentials, one webrtc api per peer connection
* send one user agent everywhere, use the vendored websocket
* route the telemost joiner through headlessclient, drop the dead keylog
* answer telemost dtls without a hello verify round trip
* follow the headlessclient dtls 1.3 mimicry rename
* follow the headless-client rename and apply the profile before the caller settings
* build every webrtc api through relay/headlessapi
* register chrome rtp header extensions for every pion consumer
* dial vk webtransport signaling through the headless quic profile
* dial dion and wb stream through the headless chrome profile
* announce chrome's http/3 settings on the vk webtransport signaling
* send chrome header blocks on bitrix http and livekit websocket
* send chrome's webtransport connect headers on vk signaling
* stop passing invented track names to the library
* move wbp http paths onto the headlessclient profile
* migrate to a published headlessclient
* dedup go.mod
connectTCP and dialCreatorUDP dialed whatever address came over the tunnel, so a joiner could make the creator reach its own LAN, loopback or the metadata ip at 169.254.169.254. dc mode had the same hole so the check lives in common now, all three paths call it. i block everything that isn't global unicast plus RFC1918 and cgnat, and ":80" too - empty host dials the local machine. names get checked inside Dialer.Control, per resolved address right before connect, so a re-resolve can't rebind past it and the dialer keeps its address fallback. with an upstream socks the name is resolved proxy-side, so there only the literal is mine to check. --allow-private-dst brings the old behaviour back.
* tunnel: stop spinning idle tickers in the vp8 writer and kcp update loop
Two hot loops woke the CPU constantly even with no traffic in the tunnel.
vp8tunnel writerLoop: sampleInterval is (1s / fps) / pacedBatch, so the
default fps=24 batch=30 gives 1.54ms - 648 ticks per second. With an empty
send queue the loop still woke on every tick just to bump idleTicks; a real
frame only goes out every keepaliveEvery ticks (~9/s), so ~639 wakeups per
second did nothing but keep the core out of deep sleep. With dualTrack there
are two such writers.
The loop now has two phases. While data flows nothing changes - the ticker
holds the frame pace and the traffic shape is identical. After 40 consecutive
empty ticks (~60ms) the ticker stops and the goroutine blocks on a select over
the send queue and a keepalive timer; incoming data returns it to pace at once.
Gaps shorter than 60ms are still ridden out on the ticker, so bursty transfers
do not flap between modes.
multi_track_kcp_tunnel updateLoop: same shape, a fixed 10ms ticker calling
Update 100 times a second regardless of traffic. While idle WaitSnd() is zero
across every session, so there is nothing to retransmit. The loop keeps 10ms
while segments are in flight and drops to 500ms once idle; sends and receives
nudge it back through a buffered channel, so the first packet after silence is
not delayed.
Measured with relay/benchidle (single track, 30s of pure idle):
before after
vp8 only 2.47 % 0.14 %
vp8 + reliable KCP 2.95 % 0.15 %
The second row is the typical mobile client configuration.
* tunnel: add an idle emission-rate test
Measures both halves of what an idle tunnel costs: frames put on the wire per
second, and CPU burned by the writer. The frame rate is the number that matters
on a phone, since every frame is a packet that keeps the radio awake.
Single track, 30s idle window:
frames/s cpu
original 7.9 2.155 %
patched, same keepalive 7.7 0.154 %
patched, keepalive 3-8s 0.2 0.007 %
The middle row is the limit of the loop fix on its own - CPU drops 14x while
the packet rate barely moves, because idle traffic is driven by the keepalive
period rather than by the ticker.
* avoid waking the kcp update loop on udp sends, cleanup
---------
Co-authored-by: jynk0 <106554291+Jynk0_btw@users.noreply.github.com>
Co-authored-by: kulikov0 <19497634+kulikov0@users.noreply.github.com>