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:
1 parent
88a0b5f1b9
commit
a735b4176e
71 files changed
+571
-2140
No files matched your search
@@ -10,7 +10,8 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/pion/webrtc/v4"
|
||||
"github.com/kulikov0/headless-client"
|
||||
"github.com/kulikov0/headless-client/webrtc"
|
||||
"whitelist-bypass/relay/common"
|
||||
"whitelist-bypass/relay/tunnel"
|
||||
"whitelist-bypass/relay/wbstream"
|
||||
@@ -76,17 +77,15 @@ func (j *WBStreamHeadlessJoiner) RunWithParams(jsonParams string) {
|
||||
}
|
||||
j.logFn("wbstream-joiner: obf key-source=%q localEpoch=0x%08x", params.RoomID, obf.LocalEpoch())
|
||||
|
||||
var settingEngine *webrtc.SettingEngine
|
||||
var configureSettingEngine func(*webrtc.SettingEngine)
|
||||
if j.PCConfig != nil {
|
||||
se := webrtc.SettingEngine{}
|
||||
j.PCConfig.ConfigureSettingEngine(&se)
|
||||
settingEngine = &se
|
||||
configureSettingEngine = j.PCConfig.ConfigureSettingEngine
|
||||
}
|
||||
|
||||
var attempt atomic.Int32
|
||||
|
||||
j.Status.EmitStatus(common.StatusConnecting)
|
||||
if err := j.runOnce(httpClient, params.RoomID, params.DisplayName, params.TunnelMode, obf, settingEngine, params.VP8FPS, params.VP8Batch, params.DualTrack, reliable, &attempt); err != nil {
|
||||
if err := j.runOnce(httpClient, params.RoomID, params.DisplayName, params.TunnelMode, obf, configureSettingEngine, params.VP8FPS, params.VP8Batch, params.DualTrack, reliable, &attempt); err != nil {
|
||||
j.Status.EmitStatusError(err.Error())
|
||||
return
|
||||
}
|
||||
@@ -106,13 +105,13 @@ func (j *WBStreamHeadlessJoiner) RunWithParams(jsonParams string) {
|
||||
}
|
||||
j.logFn("wbstream-joiner: reconnect attempt #%d", attempt.Load())
|
||||
j.Status.EmitStatus(common.StatusReconnecting)
|
||||
if err := j.runOnce(httpClient, params.RoomID, params.DisplayName, params.TunnelMode, obf, settingEngine, params.VP8FPS, params.VP8Batch, params.DualTrack, reliable, &attempt); err != nil {
|
||||
if err := j.runOnce(httpClient, params.RoomID, params.DisplayName, params.TunnelMode, obf, configureSettingEngine, params.VP8FPS, params.VP8Batch, params.DualTrack, reliable, &attempt); err != nil {
|
||||
j.logFn("wbstream-joiner: %v, will retry", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (j *WBStreamHeadlessJoiner) runOnce(httpClient *http.Client, roomID, displayName, tunnelMode string, obf *tunnel.TunnelObfuscator, settingEngine *webrtc.SettingEngine, vp8FPS, vp8Batch int, dualTrack, reliable bool, attempt *atomic.Int32) error {
|
||||
func (j *WBStreamHeadlessJoiner) runOnce(httpClient *http.Client, roomID, displayName, tunnelMode string, obf *tunnel.TunnelObfuscator, configureSettingEngine func(*webrtc.SettingEngine), vp8FPS, vp8Batch int, dualTrack, reliable bool, attempt *atomic.Int32) error {
|
||||
_, roomToken, _, serverURL, authErr := wbstream.AuthAndGetToken(httpClient, roomID, displayName)
|
||||
if authErr != nil {
|
||||
return fmt.Errorf("auth: %w", authErr)
|
||||
@@ -120,20 +119,20 @@ func (j *WBStreamHeadlessJoiner) runOnce(httpClient *http.Client, roomID, displa
|
||||
j.logFn("wbstream-joiner: server=%s", serverURL)
|
||||
|
||||
sess := wbstream.NewSession(wbstream.SessionConfig{
|
||||
RoomToken: roomToken,
|
||||
ServerURL: serverURL,
|
||||
DisplayName: displayName,
|
||||
TunnelMode: tunnelMode,
|
||||
Obfuscator: obf,
|
||||
LogFn: j.logFn,
|
||||
SettingEngine: settingEngine,
|
||||
NetDialContext: j.makeDialContext(),
|
||||
ResolveICEHost: j.ResolveFn,
|
||||
VP8FPS: vp8FPS,
|
||||
VP8Batch: vp8Batch,
|
||||
ScreenShare: dualTrack,
|
||||
IsJoiner: true,
|
||||
Reliable: reliable,
|
||||
RoomToken: roomToken,
|
||||
ServerURL: serverURL,
|
||||
DisplayName: displayName,
|
||||
TunnelMode: tunnelMode,
|
||||
Obfuscator: obf,
|
||||
LogFn: j.logFn,
|
||||
ConfigureSettingEngine: configureSettingEngine,
|
||||
NetDialContext: j.makeDialContext(),
|
||||
ResolveICEHost: j.ResolveFn,
|
||||
VP8FPS: vp8FPS,
|
||||
VP8Batch: vp8Batch,
|
||||
ScreenShare: dualTrack,
|
||||
IsJoiner: true,
|
||||
Reliable: reliable,
|
||||
})
|
||||
sess.OnConnected = func(tun tunnel.DataTunnel) {
|
||||
attempt.Store(0)
|
||||
@@ -213,11 +212,15 @@ func (j *WBStreamHeadlessJoiner) makeDialContext() func(ctx context.Context, net
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (&net.Dialer{Timeout: 10 * time.Second}).DialContext(ctx, network, resolvedIP+":"+port)
|
||||
dialer := headless.ChromeDialer()
|
||||
dialer.Timeout = 10 * time.Second
|
||||
return dialer.DialContext(ctx, network, resolvedIP+":"+port)
|
||||
}
|
||||
}
|
||||
|
||||
func (j *WBStreamHeadlessJoiner) makeHTTPClient() *http.Client {
|
||||
transport := &http.Transport{DialContext: j.makeDialContext()}
|
||||
return &http.Client{Timeout: 60 * time.Second, Transport: transport}
|
||||
return &http.Client{
|
||||
Timeout: 60 * time.Second,
|
||||
Transport: headless.ChromeWindows.Transport(headless.TLSOptions{DialContext: j.makeDialContext()}),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user