Joiner desktop windows (#89)

* base classes/logic from a playground

* fix sandbox

* add vk support
This commit is contained in:
kulikov0 authored and GitHub committed 2026-05-11 17:01:32 +02:00
1 parent 1308361eb6
commit 30ed29a161
34 files changed
+7056

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
node_modules/
dist/
+88
View File
@@ -0,0 +1,88 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'" />
<title>WhitelistBypass Joiner</title>
<link rel="stylesheet" href="styles/app.css" />
</head>
<body>
<header>
<h1>WhitelistBypass Joiner</h1>
<div class="status" id="status" data-state="idle">idle</div>
</header>
<main>
<section class="form">
<label>
Join link
<input id="link" type="text" placeholder="Paste call link" />
<span class="hint" id="platformHint">Detected platform: -</span>
</label>
<label>
Display name
<input id="name" type="text" value="Joiner" />
</label>
<div class="row">
<label>
SOCKS5 port
<input id="socksPort" type="number" value="1080" min="1" max="65535" />
</label>
<label>
DNS
<input id="dns" type="text" value="1.1.1.1,8.8.8.8" />
</label>
</div>
<div class="row">
<label>
SOCKS5 user
<input id="socksUser" type="text" />
</label>
<label>
SOCKS5 password
<input id="socksPass" type="password" />
</label>
</div>
<div class="row">
<label>
Tunnel mode
<select id="tunnelMode">
<option value="video" selected>Video (VP8)</option>
<option value="dc">DataChannel</option>
</select>
</label>
<label>
Resources
<select id="resources">
<option value="moderate">Moderate</option>
<option value="default" selected>Default</option>
<option value="unlimited">Unlimited</option>
</select>
</label>
</div>
<div class="row">
<label>
VP8 FPS
<input id="vp8Fps" type="number" value="24" min="1" max="60" />
</label>
<label>
VP8 batch
<input id="vp8Batch" type="number" value="30" min="1" max="200" />
</label>
</div>
<label class="check">
<input id="noTun" type="checkbox" />
SOCKS5 only (do not bring up wintun adapter)
</label>
<div class="actions">
<button id="start">Start</button>
<button id="stop">Stop</button>
</div>
</section>
<section class="log-wrap">
<h2>Log</h2>
<pre id="log"></pre>
</section>
</main>
<script src="dist/renderer/index.js"></script>
</body>
</html>
File diff suppressed because it is too large. Load diff
+45
View File
@@ -0,0 +1,45 @@
{
"name": "whitelist-bypass-joiner",
"version": "0.3.1",
"main": "dist/main/index.js",
"scripts": {
"build": "tsc",
"start": "tsc && electron .",
"start:dev": "electron ."
},
"devDependencies": {
"@types/node": "^22.0.0",
"electron": "^33.0.0",
"electron-builder": "^25.0.0",
"typescript": "^5.6.0"
},
"build": {
"appId": "whitelist.bypass.joiner",
"productName": "WhitelistBypass Joiner",
"directories": {
"output": "../prebuilts"
},
"files": [
"dist/**/*",
"index.html",
"styles/**/*",
"resources/**/*"
],
"win": {
"target": "portable",
"artifactName": "${productName}-${version}-${arch}.${ext}",
"icon": "resources/icon.ico",
"requestedExecutionLevel": "requireAdministrator",
"extraResources": [
{
"from": "windows-joiner/windows-joiner-bundle.exe",
"to": "windows-joiner.exe"
},
{
"from": "windows-joiner/wintun-bundle.dll",
"to": "wintun.dll"
}
]
}
}
}
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

+24
View File
@@ -0,0 +1,24 @@
export const IPC = {
START: 'joiner:start',
STOP: 'joiner:stop',
LOG: 'joiner:log',
STATUS: 'joiner:status',
RUNNING: 'joiner:running',
} as const;
export type JoinerPlatform = 'wbstream' | 'telemost' | 'vk';
export interface JoinerSettings {
platform: JoinerPlatform;
link: string;
displayName: string;
socksPort: number;
socksUser: string;
socksPass: string;
tunnelMode: 'video' | 'dc';
vp8Fps: number;
vp8Batch: number;
resources: 'moderate' | 'default' | 'unlimited';
dns: string;
noTun: boolean;
}
+158
View File
@@ -0,0 +1,158 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import { spawn, ChildProcess } from 'node:child_process';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import { IPC, JoinerSettings } from '../constants';
// Single global joiner process. We never run two tunnels at once: the
// wintun adapter and the route table are exclusive resources.
let joinerProcess: ChildProcess | null = null;
let mainWindow: BrowserWindow | null = null;
let captchaWindow: BrowserWindow | null = null;
function openCaptchaWindow(url: string) {
if (captchaWindow && !captchaWindow.isDestroyed()) {
captchaWindow.loadURL(url);
captchaWindow.focus();
return;
}
captchaWindow = new BrowserWindow({
width: 520,
height: 640,
title: 'Solve the captcha',
parent: mainWindow ?? undefined,
autoHideMenuBar: true,
webPreferences: { contextIsolation: true, nodeIntegration: false, sandbox: true },
});
captchaWindow.loadURL(url);
captchaWindow.on('closed', () => { captchaWindow = null; });
}
function closeCaptchaWindow() {
if (captchaWindow && !captchaWindow.isDestroyed()) {
captchaWindow.close();
}
captchaWindow = null;
}
function resolveJoinerExe(): string {
// When packaged, electron-builder copies windows-joiner.exe into
// resources/. In dev, look next to the source binary.
const packaged = join(process.resourcesPath || '', 'windows-joiner.exe');
if (existsSync(packaged)) return packaged;
const fallback = join(__dirname, '..', '..', '..', 'prebuilts', 'windows-joiner-x64.exe');
return fallback;
}
function send(channel: string, payload: unknown) {
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send(channel, payload);
}
}
function createWindow() {
mainWindow = new BrowserWindow({
width: 900,
height: 600,
title: 'WhitelistBypass Joiner',
icon: join(__dirname, '..', '..', 'resources', 'icon.png'),
webPreferences: {
preload: join(__dirname, '..', 'preload', 'index.js'),
contextIsolation: true,
nodeIntegration: false,
sandbox: false,
},
});
mainWindow.setMenuBarVisibility(false);
mainWindow.loadFile(join(__dirname, '..', '..', 'index.html'));
}
app.whenReady().then(() => {
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on('window-all-closed', () => {
stopJoiner();
if (process.platform !== 'darwin') app.quit();
});
ipcMain.handle(IPC.START, async (_e, settings: JoinerSettings) => {
if (joinerProcess) {
return { ok: false, error: 'joiner already running' };
}
const exe = resolveJoinerExe();
if (!existsSync(exe)) {
return { ok: false, error: `windows-joiner.exe not found at ${exe}` };
}
const args = [
'--platform', settings.platform,
'--link', settings.link,
'--name', settings.displayName,
'--socks-port', String(settings.socksPort),
'--tunnel-mode', settings.tunnelMode,
'--vp8-fps', String(settings.vp8Fps),
'--vp8-batch', String(settings.vp8Batch),
'--resources', settings.resources,
'--dns', settings.dns,
];
if (settings.socksUser) args.push('--socks-user', settings.socksUser);
if (settings.socksPass) args.push('--socks-pass', settings.socksPass);
if (settings.noTun) args.push('--no-tun');
const commandLine = [exe, ...args].map((s) => (/\s/.test(s) ? `"${s}"` : s)).join(' ');
send(IPC.LOG, `[main] spawning: ${commandLine}\n`);
try {
joinerProcess = spawn(exe, args, { windowsHide: true });
} catch (err) {
return { ok: false, error: `spawn failed: ${(err as Error).message}` };
}
send(IPC.RUNNING, true);
send(IPC.STATUS, 'starting');
joinerProcess.on('error', (err) => {
send(IPC.LOG, `[main] spawn error: ${err.message}\n`);
send(IPC.STATUS, 'stopped');
send(IPC.RUNNING, false);
joinerProcess = null;
});
const handleOutput = (text: string) => {
send(IPC.LOG, text);
if (text.includes('TUNNEL ACTIVE')) send(IPC.STATUS, 'active');
if (text.includes('TUNNEL CONNECTED')) send(IPC.STATUS, 'connected');
const captchaMatch = text.match(/STATUS:CAPTCHA:(\S+)/);
if (captchaMatch) {
openCaptchaWindow(captchaMatch[1]);
} else if (captchaWindow && /captcha solved|Auth complete|TUNNEL/i.test(text)) {
closeCaptchaWindow();
}
};
joinerProcess.stdout?.on('data', (b: Buffer) => handleOutput(b.toString()));
joinerProcess.stderr?.on('data', (b: Buffer) => handleOutput(b.toString()));
joinerProcess.on('exit', (code, signal) => {
closeCaptchaWindow();
send(IPC.LOG, `\n[main] joiner exited code=${code} signal=${signal}\n`);
send(IPC.STATUS, 'stopped');
send(IPC.RUNNING, false);
joinerProcess = null;
});
return { ok: true };
});
ipcMain.handle(IPC.STOP, async () => {
stopJoiner();
return { ok: true };
});
function stopJoiner() {
closeCaptchaWindow();
if (!joinerProcess) return;
try {
// SIGTERM on Windows ends up as TerminateProcess for the child.
// The Go binary registers a signal handler for SIGTERM which
// triggers Tunnel.Stop and tears down routes cleanly.
joinerProcess.kill('SIGTERM');
} catch {}
}
+16
View File
@@ -0,0 +1,16 @@
import { contextBridge, ipcRenderer } from 'electron';
import { IPC, JoinerSettings } from '../constants';
contextBridge.exposeInMainWorld('bridge', {
start: (settings: JoinerSettings) => ipcRenderer.invoke(IPC.START, settings),
stop: () => ipcRenderer.invoke(IPC.STOP),
onLog(cb: (text: string) => void) {
ipcRenderer.on(IPC.LOG, (_e, text) => cb(text));
},
onStatus(cb: (status: string) => void) {
ipcRenderer.on(IPC.STATUS, (_e, status) => cb(status));
},
onRunning(cb: (running: boolean) => void) {
ipcRenderer.on(IPC.RUNNING, (_e, v) => cb(v));
},
});
+98
View File
@@ -0,0 +1,98 @@
type JoinerPlatform = 'wbstream' | 'telemost' | 'vk';
function detectPlatform(url: string): JoinerPlatform | null {
const u = url.toLowerCase();
if (!u) return null;
if (u.includes('wbstream://') || u.includes('stream.wb.ru')) return 'wbstream';
if (u.includes('telemost.yandex')) return 'telemost';
return 'vk';
}
function platformLabel(p: JoinerPlatform | null): string {
switch (p) {
case 'wbstream': return 'WB Stream';
case 'telemost': return 'Telemost';
case 'vk': return 'VK';
default: return '-';
}
}
interface Bridge {
start(settings: any): Promise<{ ok: boolean; error?: string }>;
stop(): Promise<{ ok: boolean }>;
onLog(cb: (text: string) => void): void;
onStatus(cb: (status: string) => void): void;
onRunning(cb: (running: boolean) => void): void;
}
declare const bridge: Bridge;
const $ = (id: string) => document.getElementById(id) as HTMLElement;
const input = (id: string) => document.getElementById(id) as HTMLInputElement;
const select = (id: string) => document.getElementById(id) as HTMLSelectElement;
const logEl = $('log') as HTMLPreElement;
const statusEl = $('status');
const startBtn = $('start') as HTMLButtonElement;
const stopBtn = $('stop') as HTMLButtonElement;
const platformHint = $('platformHint');
const linkInput = input('link');
stopBtn.disabled = true;
function refreshPlatformHint() {
const p = detectPlatform(linkInput.value.trim());
platformHint.textContent = `Detected platform: ${platformLabel(p)}`;
platformHint.dataset.detected = p ?? '';
}
linkInput.addEventListener('input', refreshPlatformHint);
refreshPlatformHint();
function appendLog(text: string) {
logEl.textContent += text;
logEl.scrollTop = logEl.scrollHeight;
}
bridge.onLog((text) => appendLog(text));
bridge.onStatus((s) => {
statusEl.textContent = s;
statusEl.dataset.state = s;
});
bridge.onRunning((running) => {
startBtn.disabled = running;
stopBtn.disabled = !running;
});
startBtn.addEventListener('click', async () => {
appendLog('\n[ui] starting joiner...\n');
const link = linkInput.value.trim();
if (!link) {
appendLog('[ui] link is required\n');
return;
}
const platform = detectPlatform(link);
if (!platform) {
appendLog('[ui] link does not look like a WB Stream or Telemost call\n');
return;
}
const settings = {
platform,
link,
displayName: input('name').value.trim() || 'Joiner',
socksPort: parseInt(input('socksPort').value, 10) || 1080,
socksUser: input('socksUser').value,
socksPass: input('socksPass').value,
tunnelMode: select('tunnelMode').value,
vp8Fps: parseInt(input('vp8Fps').value, 10) || 24,
vp8Batch: parseInt(input('vp8Batch').value, 10) || 30,
resources: select('resources').value,
dns: input('dns').value.trim() || '1.1.1.1,8.8.8.8',
noTun: input('noTun').checked,
};
const r = await bridge.start(settings);
if (!r.ok) appendLog(`[ui] start failed: ${r.error}\n`);
});
stopBtn.addEventListener('click', async () => {
appendLog('\n[ui] stopping joiner...\n');
await bridge.stop();
});
+56
View File
@@ -0,0 +1,56 @@
:root {
color-scheme: dark;
--bg: #1a1b1f;
--bg-elev: #23252b;
--fg: #e6e8ea;
--muted: #8a8f99;
--accent: #4f88ff;
--danger: #c8472b;
--ok: #36a36a;
}
* { box-sizing: border-box; }
html, body {
margin: 0; height: 100%;
font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: var(--bg); color: var(--fg);
}
body { display: flex; flex-direction: column; }
header {
display: flex; align-items: center; justify-content: space-between;
padding: 10px 16px; border-bottom: 1px solid #2c2e35;
}
h1 { font-size: 14px; margin: 0; }
.status {
font-size: 12px; padding: 3px 10px; border-radius: 10px;
background: #2c2e35; color: var(--muted);
}
.status[data-state="active"], .status[data-state="connected"] { background: var(--ok); color: #fff; }
.status[data-state="stopped"] { background: #4a3030; color: #ffb4a8; }
main { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; min-height: 0; }
section.form { display: flex; flex-direction: column; gap: 10px; }
section.log-wrap { display: flex; flex-direction: column; min-height: 0; }
section.log-wrap h2 { font-size: 12px; margin: 0 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
pre#log {
flex: 1; margin: 0; padding: 10px; background: var(--bg-elev);
border: 1px solid #2c2e35; border-radius: 6px;
font: 11.5px/1.5 "SF Mono", Menlo, Consolas, monospace;
color: #c5c8cf; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--fg); }
.hint { font-size: 11px; color: var(--muted); }
.hint[data-detected="wbstream"], .hint[data-detected="telemost"] { color: var(--ok); }
input, select {
font-size: 13px; padding: 6px 8px;
background: var(--bg-elev); color: var(--fg);
border: 1px solid #2c2e35; border-radius: 4px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions { display: flex; gap: 8px; margin-top: 6px; }
button {
flex: 1; padding: 8px 12px; border: none; border-radius: 4px;
background: var(--accent); color: #fff; font-weight: 500; cursor: pointer;
}
button#stop { background: var(--danger); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
+18
View File
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "commonjs",
"lib": ["ESNext", "DOM"],
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": false,
"sourceMap": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist", "windows-joiner"]
}
@@ -0,0 +1,5 @@
windows-joiner-*.exe
windows-joiner-bundle.exe
wintun-*.dll
wintun-bundle.dll
wintun.zip
+49
View File
@@ -0,0 +1,49 @@
module windows-joiner
go 1.26.1
require whitelist-bypass/relay v0.0.0
require (
github.com/ajg/form v1.5.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/go-chi/chi/v5 v5.2.1 // indirect
github.com/go-chi/cors v1.2.1 // indirect
github.com/go-chi/render v1.0.3 // indirect
github.com/go-gost/relay v0.5.0 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/schema v1.4.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/pion/datachannel v1.6.0 // indirect
github.com/pion/dtls/v3 v3.1.2 // indirect
github.com/pion/ice/v4 v4.2.1 // indirect
github.com/pion/interceptor v0.1.44 // indirect
github.com/pion/logging v0.2.4 // indirect
github.com/pion/mdns/v2 v2.1.0 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/rtcp v1.2.16 // indirect
github.com/pion/rtp v1.10.1 // indirect
github.com/pion/sctp v1.9.2 // indirect
github.com/pion/sdp/v3 v3.0.18 // indirect
github.com/pion/srtp/v3 v3.0.10 // indirect
github.com/pion/stun/v3 v3.1.1 // indirect
github.com/pion/transport/v4 v4.0.1 // indirect
github.com/pion/turn/v4 v4.1.4 // indirect
github.com/pion/webrtc/v4 v4.2.9 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
github.com/xjasonlyu/tun2socks/v2 v2.6.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/time v0.11.0 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb // indirect
gvisor.dev/gvisor v0.0.0-20250523182742-eede7a881b20 // indirect
)
replace whitelist-bypass/relay => ../../relay
+90
View File
@@ -0,0 +1,90 @@
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/go-chi/chi/v5 v5.2.1 h1:KOIHODQj58PmL80G2Eak4WdvUzjSJSm0vG72crDCqb8=
github.com/go-chi/chi/v5 v5.2.1/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4=
github.com/go-chi/render v1.0.3/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0=
github.com/go-gost/relay v0.5.0 h1:JG1tgy/KWiVXS0ukuVXvbM0kbYuJTWxYpJ5JwzsCf/c=
github.com/go-gost/relay v0.5.0/go.mod h1:lcX+23LCQ3khIeASBo+tJ/WbwXFO32/N5YN6ucuYTG8=
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/pion/datachannel v1.6.0 h1:XecBlj+cvsxhAMZWFfFcPyUaDZtd7IJvrXqlXD/53i0=
github.com/pion/datachannel v1.6.0/go.mod h1:ur+wzYF8mWdC+Mkis5Thosk+u/VOL287apDNEbFpsIk=
github.com/pion/dtls/v3 v3.1.2 h1:gqEdOUXLtCGW+afsBLO0LtDD8GnuBBjEy6HRtyofZTc=
github.com/pion/dtls/v3 v3.1.2/go.mod h1:Hw/igcX4pdY69z1Hgv5x7wJFrUkdgHwAn/Q/uo7YHRo=
github.com/pion/ice/v4 v4.2.1 h1:XPRYXaLiFq3LFDG7a7bMrmr3mFr27G/gtXN3v/TVfxY=
github.com/pion/ice/v4 v4.2.1/go.mod h1:2quLV1S5v1tAx3VvAJaH//KGitRXvo4RKlX6D3tnN+c=
github.com/pion/interceptor v0.1.44 h1:sNlZwM8dWXU9JQAkJh8xrarC0Etn8Oolcniukmuy0/I=
github.com/pion/interceptor v0.1.44/go.mod h1:4atVlBkcgXuUP+ykQF0qOCGU2j7pQzX2ofvPRFsY5RY=
github.com/pion/logging v0.2.4 h1:tTew+7cmQ+Mc1pTBLKH2puKsOvhm32dROumOZ655zB8=
github.com/pion/logging v0.2.4/go.mod h1:DffhXTKYdNZU+KtJ5pyQDjvOAh/GsNSyv1lbkFbe3so=
github.com/pion/mdns/v2 v2.1.0 h1:3IJ9+Xio6tWYjhN6WwuY142P/1jA0D5ERaIqawg/fOY=
github.com/pion/mdns/v2 v2.1.0/go.mod h1:pcez23GdynwcfRU1977qKU0mDxSeucttSHbCSfFOd9A=
github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA=
github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8=
github.com/pion/rtcp v1.2.16 h1:fk1B1dNW4hsI78XUCljZJlC4kZOPk67mNRuQ0fcEkSo=
github.com/pion/rtcp v1.2.16/go.mod h1:/as7VKfYbs5NIb4h6muQ35kQF/J0ZVNz2Z3xKoCBYOo=
github.com/pion/rtp v1.10.1 h1:xP1prZcCTUuhO2c83XtxyOHJteISg6o8iPsE2acaMtA=
github.com/pion/rtp v1.10.1/go.mod h1:rF5nS1GqbR7H/TCpKwylzeq6yDM+MM6k+On5EgeThEM=
github.com/pion/sctp v1.9.2 h1:HxsOzEV9pWoeggv7T5kewVkstFNcGvhMPx0GvUOUQXo=
github.com/pion/sctp v1.9.2/go.mod h1:OTOlsQ5EDQ6mQ0z4MUGXt2CgQmKyafBEXhUVqLRB6G8=
github.com/pion/sdp/v3 v3.0.18 h1:l0bAXazKHpepazVdp+tPYnrsy9dfh7ZbT8DxesH5ZnI=
github.com/pion/sdp/v3 v3.0.18/go.mod h1:ZREGo6A9ZygQ9XkqAj5xYCQtQpif0i6Pa81HOiAdqQ8=
github.com/pion/srtp/v3 v3.0.10 h1:tFirkpBb3XccP5VEXLi50GqXhv5SKPxqrdlhDCJlZrQ=
github.com/pion/srtp/v3 v3.0.10/go.mod h1:3mOTIB0cq9qlbn59V4ozvv9ClW/BSEbRp4cY0VtaR7M=
github.com/pion/stun/v3 v3.1.1 h1:CkQxveJ4xGQjulGSROXbXq94TAWu8gIX2dT+ePhUkqw=
github.com/pion/stun/v3 v3.1.1/go.mod h1:qC1DfmcCTQjl9PBaMa5wSn3x9IPmKxSdcCsxBcDBndM=
github.com/pion/transport/v3 v3.1.1 h1:Tr684+fnnKlhPceU+ICdrw6KKkTms+5qHMgw6bIkYOM=
github.com/pion/transport/v3 v3.1.1/go.mod h1:+c2eewC5WJQHiAA46fkMMzoYZSuGzA/7E2FPrOYHctQ=
github.com/pion/transport/v4 v4.0.1 h1:sdROELU6BZ63Ab7FrOLn13M6YdJLY20wldXW2Cu2k8o=
github.com/pion/transport/v4 v4.0.1/go.mod h1:nEuEA4AD5lPdcIegQDpVLgNoDGreqM/YqmEx3ovP4jM=
github.com/pion/turn/v4 v4.1.4 h1:EU11yMXKIsK43FhcUnjLlrhE4nboHZq+TXBIi3QpcxQ=
github.com/pion/turn/v4 v4.1.4/go.mod h1:ES1DXVFKnOhuDkqn9hn5VJlSWmZPaRJLyBXoOeO/BmQ=
github.com/pion/webrtc/v4 v4.2.9 h1:DZIh1HAhPIL3RvwEDFsmL5hfPSLEpxsQk9/Jir2vkJE=
github.com/pion/webrtc/v4 v4.2.9/go.mod h1:9EmLZve0H76eTzf8v2FmchZ6tcBXtDgpfTEu+drW6SY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU=
github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
github.com/xjasonlyu/tun2socks/v2 v2.6.0 h1:gI9saJT3XgH4e6v9jBuHRLwK7l3aN9YFWec/SsDTDx4=
github.com/xjasonlyu/tun2socks/v2 v2.6.0/go.mod h1:35AwqxIxnMkfBfT0UJ1Lku7PZm2ZiZJ8sxHyp0gt1yw=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg=
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI=
golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb h1:whnFRlWMcXI9d+ZbWg+4sHnLp52d5yiIPUxMBSt4X9A=
golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb/go.mod h1:rpwXGsirqLqN2L0JDJQlwOboGHmptD5ZD6T2VmcqhTw=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gvisor.dev/gvisor v0.0.0-20250523182742-eede7a881b20 h1:0DxLu8hxI1OGp1qVRPqNd+2k1a7hMNUNqbZG0IrtKlM=
gvisor.dev/gvisor v0.0.0-20250523182742-eede7a881b20/go.mod h1:3r5CMtNQMKIvBlrmM9xWUNamjKBYPOWyXOjmg5Kts3g=
+394
View File
@@ -0,0 +1,394 @@
// Command windows-joiner is the engine behind the Windows joiner GUI.
// It runs a headless WB Stream or Telemost joiner exactly like the
// Linux CLIs in headless/{wbstream,telemost}-joiner, but additionally
// brings up a wintun adapter so every IP packet on the host is steered
// through the resulting SOCKS5 proxy.
//
// It must run with administrator rights (the embedded manifest asks
// for them); creating wintun adapters and editing the route table
// both require elevation.
package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net"
"net/url"
"os"
"os/signal"
"path/filepath"
"runtime/debug"
"strings"
"sync"
"syscall"
"time"
joinerCommon "whitelist-bypass/relay/pion/headless-joiner-common"
"whitelist-bypass/relay/common"
"whitelist-bypass/relay/pion"
"whitelist-bypass/relay/tunnel"
"whitelist-bypass/relay/wbstream"
"whitelist-bypass/relay/wintunnel"
)
type statusEmitter struct{}
func (statusEmitter) EmitStatus(status string) {
log.Printf("[status] %s", status)
// CAPTCHA:url is fired by the VK auth path when an interactive
// captcha is required. The Electron wrapper watches stdout for
// this exact prefix and opens a BrowserWindow at the URL.
if strings.HasPrefix(status, "CAPTCHA:") {
fmt.Printf("STATUS:%s\n", status)
}
}
func (statusEmitter) EmitStatusError(msg string) { log.Printf("[status] ERROR: %s", msg) }
type fileCacheStore struct{ dir string }
func newFileCacheStore() *fileCacheStore {
dir, _ := os.UserCacheDir()
if dir == "" {
dir = os.TempDir()
}
cacheDir := filepath.Join(dir, "whitelist-bypass")
os.MkdirAll(cacheDir, 0755)
return &fileCacheStore{dir: cacheDir}
}
func (c *fileCacheStore) Save(key, value string) {
os.WriteFile(filepath.Join(c.dir, key), []byte(value), 0644)
}
func (c *fileCacheStore) Load(key string) string {
data, err := os.ReadFile(filepath.Join(c.dir, key))
if err != nil {
return ""
}
return string(data)
}
const (
tunAdapter = "WhitelistBypass"
tunIP = "10.99.0.2"
tunMask = "255.255.255.0"
tunPeer = "10.99.0.1"
tunMTU = 1500
)
func main() {
platform := flag.String("platform", "", "wbstream | telemost | vk (required)")
link := flag.String("link", "", "WB Stream room link, Telemost join URI, or VK call link (required)")
displayName := flag.String("name", "Joiner", "display name in the room")
socksPort := flag.Int("socks-port", 1080, "local SOCKS5 port")
socksUser := flag.String("socks-user", "", "optional SOCKS5 username")
socksPass := flag.String("socks-pass", "", "optional SOCKS5 password")
resources := flag.String("resources", "default", "moderate | default | unlimited")
tunnelMode := flag.String("tunnel-mode", "video", "tunnel mode for WB Stream: video | dc")
vp8FPS := flag.Int("vp8-fps", 24, "VP8 frame rate")
vp8Batch := flag.Int("vp8-batch", 30, "VP8 batch multiplier")
dns := flag.String("dns", "1.1.1.1,8.8.8.8", "comma-separated DNS servers for the tunnel adapter")
noTun := flag.Bool("no-tun", false, "expose SOCKS5 only, do not bring up the wintun adapter")
flag.Parse()
if *platform == "" || *link == "" {
log.Fatal("--platform and --link are required")
}
switch *resources {
case "moderate":
debug.SetMemoryLimit(64 << 20)
case "default":
debug.SetMemoryLimit(128 << 20)
case "unlimited":
debug.SetMemoryLimit(256 << 20)
default:
log.Fatalf("[config] unknown resources mode: %s", *resources)
}
common.MaskingEnabled = true
// One wintunnel.Tunnel covers both platforms. Created up-front so
// signaling-host bypass routes can be installed before any platform
// code touches the network.
var tun *wintunnel.Tunnel
if !*noTun {
cfg := wintunnel.Config{
AdapterName: tunAdapter,
TunnelIP: tunIP,
TunnelMask: tunMask,
TunnelPeer: tunPeer,
MTU: tunMTU,
DNSServers: splitCSV(*dns),
SocksHost: "127.0.0.1",
SocksPort: *socksPort,
SocksUser: *socksUser,
SocksPass: *socksPass,
LogFn: log.Printf,
}
var err error
tun, err = wintunnel.New(cfg)
if err != nil {
log.Fatalf("[wintunnel] init: %v", err)
}
}
// Add bypass routes for the signaling hosts before any traffic
// from the joiner reaches them. These are needed even before
// engine.Start, because the joiner opens its WebSocket as soon
// as we call Start() below.
bypassHosts := signalingHosts(*platform, *link)
preResolved := map[string][]net.IP{}
for _, h := range bypassHosts {
ips, err := net.LookupIP(h)
if err != nil {
log.Printf("[bypass] resolve %s: %v (will rely on candidate hook)", h, err)
continue
}
preResolved[h] = ips
log.Printf("[bypass] %s -> %v (pre-tun)", h, ips)
}
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, syscall.SIGTERM)
tunReady := make(chan struct{})
var tunOnce sync.Once
bringUpTun := func() {
tunOnce.Do(func() {
if tun == nil {
close(tunReady)
return
}
if err := tun.Start(); err != nil {
log.Fatalf("[wintunnel] start: %v", err)
}
// Now that the tunnel knows the original gateway,
// pin /32 bypass routes for the signaling hosts.
for host, ips := range preResolved {
for _, ip := range ips {
if err := tun.AddBypassIP(ip); err != nil {
log.Printf("[bypass] %s ip %s: %v", host, ip, err)
}
}
}
fmt.Printf("\n TUNNEL ACTIVE on adapter %q (DNS=%s)\n all traffic now egresses via %s\n\n",
tunAdapter, *dns, *platform)
close(tunReady)
})
}
addCandidate := func(target int, candidateOrSDP string) {
if tun == nil {
return
}
if err := tun.AddBypassFromCandidate(candidateOrSDP); err != nil {
log.Printf("[bypass] candidate: %v", err)
}
// SDP path: scan every candidate line in the blob
if strings.Contains(candidateOrSDP, "a=candidate:") {
for _, line := range strings.Split(candidateOrSDP, "\n") {
line = strings.TrimRight(line, "\r")
if strings.HasPrefix(line, "a=candidate:") {
if err := tun.AddBypassFromCandidate(line); err != nil {
log.Printf("[bypass] sdp candidate: %v", err)
}
}
}
}
}
onConnected := func(t tunnel.DataTunnel) {
readBuf := common.VP8BufSize
if _, ok := t.(*tunnel.DCTunnel); ok {
readBuf = common.DCBufSize
}
bridge := tunnel.NewRelayBridgeWithAuth(t, "joiner", readBuf, log.Printf, *socksUser, *socksPass)
bridge.MarkReady()
addr := fmt.Sprintf("127.0.0.1:%d", *socksPort)
go func() {
if err := bridge.ListenSOCKS(addr); err != nil {
log.Printf("[socks] listen: %v", err)
}
}()
log.Printf("[socks] listening on %s", addr)
// SOCKS5 is up; bring up wintun so the OS starts steering
// traffic into it. Doing this after the joiner has connected
// also means we already have remote candidates and bypass
// routes are in place.
bringUpTun()
}
switch strings.ToLower(*platform) {
case "wbstream", "wb":
runWBStream(*link, *displayName, *tunnelMode, *vp8FPS, *vp8Batch,
onConnected, addCandidate)
case "telemost", "tm":
runTelemost(*link, *displayName, *vp8FPS, *vp8Batch,
onConnected, addCandidate)
case "vk":
runVK(*link, *displayName, *tunnelMode, *vp8FPS, *vp8Batch,
onConnected, addCandidate)
default:
log.Fatalf("[config] unknown --platform %q", *platform)
}
<-sig
log.Printf("[main] shutting down")
if tun != nil {
tun.Stop()
}
// Give in-flight goroutines a beat to drain before the process exits.
time.Sleep(200 * time.Millisecond)
}
func splitCSV(s string) []string {
var out []string
for _, p := range strings.Split(s, ",") {
p = strings.TrimSpace(p)
if p != "" {
out = append(out, p)
}
}
return out
}
func signalingHosts(platform, link string) []string {
switch strings.ToLower(platform) {
case "wbstream", "wb":
return []string{"stream.wb.ru", "wbstream01-el.wb.ru"}
case "telemost", "tm":
hosts := []string{"telemost.yandex.ru", "telemost-api.yandex.ru"}
if u, err := url.Parse(strings.TrimSpace(link)); err == nil && u.Host != "" {
hosts = append(hosts, u.Host)
}
return hosts
case "vk":
hosts := []string{"vk.com", "login.vk.com", "api.vk.com", "ok.ru", "cloud-api.yandex.ru"}
if u, err := url.Parse(strings.TrimSpace(link)); err == nil && u.Host != "" {
hosts = append(hosts, u.Host)
}
return hosts
}
return nil
}
func runWBStream(link, name, mode string, fps, batch int,
onConnected func(tunnel.DataTunnel),
onCandidate func(int, string),
) {
id := strings.TrimPrefix(strings.TrimSpace(link), "wbstream://")
roomID, roomToken, _, err := wbstream.AuthAndGetToken(nil, id, name)
if err != nil {
log.Fatalf("[wb] auth: %v", err)
}
log.Printf("[wb] room=%s mode=%s", roomID, mode)
obf, err := tunnel.NewTunnelObfuscator(tunnel.DeriveSecretFromJoinLink(roomID))
if err != nil {
log.Fatalf("[wb] obfuscator: %v", err)
}
sess := wbstream.NewSession(wbstream.SessionConfig{
RoomToken: roomToken,
DisplayName: name,
TunnelMode: mode,
Obfuscator: obf,
LogFn: log.Printf,
VP8FPS: fps,
VP8Batch: batch,
})
sess.OnConnected = onConnected
sess.OnRemoteCandidate = onCandidate
if err := sess.Start(); err != nil {
log.Fatalf("[wb] session: %v", err)
}
}
func runTelemost(link, name string, fps, batch int,
onConnected func(tunnel.DataTunnel),
onCandidate func(int, string),
) {
inner := joinerCommon.NewTelemostHeadlessJoiner(
log.Printf,
resolveHostname,
statusEmitter{},
nil,
pion.AddTunnelTracks,
pion.ReadTrack,
)
inner.OnConnected = onConnected
inner.OnRemoteCandidate = onCandidate
params, _ := json.Marshal(struct {
JoinLink string `json:"joinLink"`
DisplayName string `json:"displayName"`
VP8FPS int `json:"vp8Fps"`
VP8Batch int `json:"vp8Batch"`
}{
JoinLink: strings.TrimSpace(link),
DisplayName: name,
VP8FPS: fps,
VP8Batch: batch,
})
go inner.RunWithParams(string(params))
}
func runVK(link, name, mode string, fps, batch int,
onConnected func(tunnel.DataTunnel),
onCandidate func(int, string),
) {
emitter := statusEmitter{}
statusFn := func(s string) { emitter.EmitStatus(s) }
authJSON, err := joinerCommon.RunVKAuth(strings.TrimSpace(link), name,
log.Printf, statusFn, newFileCacheStore(), resolveHostname)
if err != nil {
log.Fatalf("[vk] auth: %v", err)
}
var authParams map[string]interface{}
if json.Unmarshal([]byte(authJSON), &authParams) != nil {
log.Fatalf("[vk] auth response not JSON: %s", authJSON)
}
authParams["tunnelMode"] = mode
authParams["vp8Fps"] = fps
authParams["vp8Batch"] = batch
patched, err := json.Marshal(authParams)
if err != nil {
log.Fatalf("[vk] auth marshal: %v", err)
}
inner := joinerCommon.NewVKHeadlessJoiner(
log.Printf,
resolveHostname,
emitter,
nil,
pion.AddTunnelTracks,
pion.ReadTrack,
)
inner.OnConnected = onConnected
inner.OnRemoteCandidate = onCandidate
go inner.RunWithParams(string(patched))
}
func resolveHostname(hostname string) (string, error) {
if ip := net.ParseIP(hostname); ip != nil {
return hostname, nil
}
ips, err := net.LookupIP(hostname)
if err != nil {
return "", err
}
for _, ip := range ips {
if v4 := ip.To4(); v4 != nil {
return v4.String(), nil
}
}
for _, ip := range ips {
return ip.String(), nil
}
return "", fmt.Errorf("no IPs for %s", hostname)
}
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="whitelist.bypass.windows-joiner"
version="1.0.0.0"
processorArchitecture="*"/>
<description>Whitelist Bypass Windows Joiner</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10/11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
</assembly>