v62: fetch POST multipart/form-data вместо WebSocket+base64 — обход DPI

This commit is contained in:
“Naeel”
2026-05-22 18:19:19 +04:00
parent 1f3dce39a4
commit b71eb9a45f
7 changed files with 180 additions and 38 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
"""Test: find DPI threshold — how many WS frames before DPI kills connection."""
import asyncio, json, websockets, base64, os
async def test_chunks(n_chunks, delay=0.15):
uri = "wss://proxy.kube5s.ru/ws"
chunk_data = base64.b64encode(os.urandom(5000)).decode() # ~6.7KB per chunk
try:
async with websockets.connect(uri) as ws:
# Send data chunks
for i in range(n_chunks):
msg = json.dumps({"c": i, "n": n_chunks, "t": "test", "b": chunk_data, "m": "audio/webm"})
await ws.send(msg)
await asyncio.sleep(delay)
# Final
await ws.send(json.dumps({"c": -1}))
try:
resp = await asyncio.wait_for(ws.recv(), timeout=15)
data = json.loads(resp)
return f"OK: {data.get('error','?')}"
except asyncio.TimeoutError:
return "TIMEOUT"
except Exception as e:
return f"CONN_ERR: {e}"
async def main():
for n in [1, 2, 3, 4, 5, 8]:
result = await test_chunks(n, delay=0.2)
print(f" chunks={n}: {result}")
asyncio.run(main())