erase fingerprints (#177)

* 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
This commit is contained in:
kulikov0 authored and GitHub committed 2026-09-12 20:39:06 +02:00
1 parent 88a0b5f1b9
commit a735b4176e
71 files changed
+571 -2140

No files matched your search

+13 -13
View File
@@ -10,7 +10,7 @@ import (
"net/url"
"strings"
"whitelist-bypass/relay/common"
"github.com/kulikov0/headless-client"
)
const (
@@ -71,9 +71,14 @@ type connectionDetailsResponse struct {
}
func httpDo(client *http.Client, req *http.Request) (*http.Response, error) {
req.Header.Set("User-Agent", common.UserAgent)
req.Header.Set("User-Agent", headless.ChromeWindows.UserAgent())
for name, values := range headless.ChromeWindows.Headers(headless.DestEmpty) {
if _, present := req.Header[name]; !present {
req.Header[name] = values
}
}
if client == nil {
client = http.DefaultClient
client = headless.ChromeWindows.HTTPClient()
}
return client.Do(req)
}
@@ -87,7 +92,7 @@ func (t *cookieTransport) RoundTrip(req *http.Request) (*http.Response, error) {
req.Header.Set("Cookie", t.cookie)
base := t.base
if base == nil {
base = http.DefaultTransport
base = headless.ChromeWindows.HTTPClient().Transport
}
return base.RoundTrip(req)
}
@@ -97,7 +102,7 @@ func clientWithCookies(client *http.Client, cookieHeader string) *http.Client {
return client
}
if client == nil {
client = &http.Client{}
client = headless.ChromeWindows.HTTPClient()
}
wrapped := *client
wrapped.Transport = &cookieTransport{base: client.Transport, cookie: cookieHeader}
@@ -282,12 +287,8 @@ func RefreshAccessToken(client *http.Client, cookieHeader, deviceID string) (str
req.Header.Set("Origin", Origin)
req.Header.Set("Referer", Origin+"/")
req.Header.Set("Cookie", cookieHeader)
req.Header.Set("User-Agent", common.UserAgent)
if client == nil {
client = http.DefaultClient
}
resp, err := client.Do(req)
resp, err := httpDo(client, req)
if err != nil {
return "", nil, err
}
@@ -357,7 +358,7 @@ func SetParticipantPermissions(client *http.Client, accessToken, roomID, partici
func KickParticipant(client *http.Client, accessToken, roomID, participantID string) error {
if client == nil {
client = http.DefaultClient
client = headless.ChromeWindows.HTTPClient()
}
kickURL := fmt.Sprintf("%s/api-room-manager/api/v1/room/%s/participant/%s/kick", APIBase, roomID, participantID)
req, err := http.NewRequest("DELETE", kickURL, strings.NewReader("{}"))
@@ -366,8 +367,7 @@ func KickParticipant(client *http.Client, accessToken, roomID, participantID str
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+accessToken)
req.Header.Set("User-Agent", common.UserAgent)
resp, err := client.Do(req)
resp, err := httpDo(client, req)
if err != nil {
return err
}
+30 -44
View File
@@ -4,14 +4,13 @@ import (
"context"
"log"
"net"
"net/http"
"sync"
"time"
"github.com/google/uuid"
headless "github.com/kulikov0/headless-client"
"github.com/kulikov0/headless-client/webrtc"
"github.com/pion/rtp"
"github.com/pion/rtp/codecs"
"github.com/pion/webrtc/v4"
"whitelist-bypass/relay/common"
"whitelist-bypass/relay/livekit"
"whitelist-bypass/relay/tunnel"
@@ -31,23 +30,23 @@ const (
)
type SessionConfig struct {
RoomToken string
ServerURL string
DisplayName string
TunnelMode string
Obfuscator *tunnel.TunnelObfuscator
LogFn func(string, ...any)
SettingEngine *webrtc.SettingEngine
NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error)
ResolveICEHost func(host string) (string, error)
VP8FPS int
VP8Batch int
RoomID string
AccessToken string
ReadBuf int
ScreenShare bool // when true, publish a second VP8 track as ScreenShare and shard outbound across both
IsJoiner bool // when true, run the configPingPong loop; only the joiner sends VP8 config to the peer
Reliable bool
RoomToken string
ServerURL string
DisplayName string
TunnelMode string
Obfuscator *tunnel.TunnelObfuscator
LogFn func(string, ...any)
ConfigureSettingEngine func(*webrtc.SettingEngine)
NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error)
ResolveICEHost func(host string) (string, error)
VP8FPS int
VP8Batch int
RoomID string
AccessToken string
ReadBuf int
ScreenShare bool // when true, publish a second VP8 track as ScreenShare and shard outbound across both
IsJoiner bool // when true, run the configPingPong loop; only the joiner sends VP8 config to the peer
Reliable bool
}
type Session struct {
@@ -106,15 +105,15 @@ func (s *Session) Done() <-chan struct{} { return s.done }
func (s *Session) Start() error {
lk, err := livekit.NewClient(livekit.Config{
ServerURL: s.cfg.ServerURL,
Token: s.cfg.RoomToken,
Origin: Origin,
UserAgent: common.UserAgent,
Codec: livekit.ProtoCodec{},
LogFn: s.cfg.LogFn,
SettingEngine: s.cfg.SettingEngine,
NetDialContext: s.cfg.NetDialContext,
ResolveICEHost: s.cfg.ResolveICEHost,
ServerURL: s.cfg.ServerURL,
Token: s.cfg.RoomToken,
Origin: Origin,
UserAgent: headless.ChromeWindows.UserAgent(),
Codec: livekit.ProtoCodec{},
LogFn: s.cfg.LogFn,
ConfigureSettingEngine: s.cfg.ConfigureSettingEngine,
NetDialContext: s.cfg.NetDialContext,
ResolveICEHost: s.cfg.ResolveICEHost,
})
if err != nil {
return err
@@ -171,10 +170,8 @@ func (s *Session) onLKReady() {
return
}
camID := "videochannel-" + uuid.New().String()
trackCam, err := webrtc.NewTrackLocalStaticSample(
webrtc.RTPCodecCapability{MimeType: webrtc.MimeTypeVP8, ClockRate: 90000},
camID, "tunnel-video-"+uuid.New().String(),
)
if err != nil {
s.cfg.LogFn("[lk] create local cam track: %v", err)
@@ -183,10 +180,8 @@ func (s *Session) onLKReady() {
tracks := []*webrtc.TrackLocalStaticSample{trackCam}
if s.cfg.ScreenShare {
screenID := "screenchannel-" + uuid.New().String()
trackScreen, err := webrtc.NewTrackLocalStaticSample(
webrtc.RTPCodecCapability{MimeType: webrtc.MimeTypeVP8, ClockRate: 90000},
screenID, "tunnel-screen-"+uuid.New().String(),
)
if err != nil {
s.cfg.LogFn("[lk] create local screen track: %v", err)
@@ -482,10 +477,6 @@ func (s *Session) AdaptTrackCount(peerCount int) {
s.cfg.LogFn("[lk] adapt-track-count: renegotiation offer sent (%d bytes)", len(offer.SDP))
}
// removePublisherTrack stops the trailing transceiver, drops its sub-tunnel
// from the multi-track wrapper, and trims the bookkeeping slices. The SFU
// sees the transceiver go inactive on the next renegotiation and stops
// forwarding the track to subscribers. Slot 0 is preserved.
func (s *Session) removePublisherTrack() bool {
s.mu.Lock()
if len(s.sampleTransceivers) <= 1 || len(s.sampleTracks) <= 1 {
@@ -514,17 +505,12 @@ func (s *Session) removePublisherTrack() bool {
}
func (s *Session) addPublisherTrack(pubPC *webrtc.PeerConnection, slot int) bool {
labelPrefix := "screenchannel-"
streamPrefix := "tunnel-screen-"
source := livekit.TrackSourceScreenShare
if slot == 0 {
labelPrefix = "videochannel-"
streamPrefix = "tunnel-video-"
source = livekit.TrackSourceCamera
}
track, err := webrtc.NewTrackLocalStaticSample(
webrtc.RTPCodecCapability{MimeType: webrtc.MimeTypeVP8, ClockRate: 90000},
labelPrefix+uuid.New().String(), streamPrefix+uuid.New().String(),
)
if err != nil {
s.cfg.LogFn("[lk] adapt-track-count: new track slot=%d: %v", slot, err)
@@ -728,7 +714,7 @@ func (s *Session) onParticipantUpdate(updates []livekit.ParticipantInfo) {
if e.identity == "" {
continue
}
if err := KickParticipant(http.DefaultClient, s.cfg.AccessToken, s.cfg.RoomID, e.identity); err != nil {
if err := KickParticipant(headless.ChromeWindows.HTTPClient(), s.cfg.AccessToken, s.cfg.RoomID, e.identity); err != nil {
s.cfg.LogFn("[wb] kick failed identity=%s: %v", e.identity, err)
continue
}
@@ -744,7 +730,7 @@ func (s *Session) onParticipantUpdate(updates []livekit.ParticipantInfo) {
}
func (s *Session) promotePeer(sid, identity string) {
if err := SetParticipantPermissions(http.DefaultClient, s.cfg.AccessToken, s.cfg.RoomID, identity, ModeratorPermissions); err != nil {
if err := SetParticipantPermissions(headless.ChromeWindows.HTTPClient(), s.cfg.AccessToken, s.cfg.RoomID, identity, ModeratorPermissions); err != nil {
s.cfg.LogFn("[wb] promote failed identity=%s: %v", identity, err)
s.mu.Lock()
if entry, ok := s.peersBySID[sid]; ok {