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
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""Test: send chunked base64 to WS, check if server receives all chunks."""
import asyncio, json, websockets, base64, os, sys
# Generate fake audio — random bytes, base64 encoded
fake_audio = base64.b64encode(os.urandom(40000)).decode() # ~53KB base64
CHUNK = 14000
total = (len(fake_audio) + CHUNK - 1) // CHUNK
async def test():
uri = "wss://proxy.kube5s.ru/ws"
print(f"Connecting to {uri}...")
async with websockets.connect(uri) as ws:
print(f"Connected. Sending {total} chunks of {CHUNK} chars each (total b64: {len(fake_audio)} chars)...")
for i in range(total):
chunk = fake_audio[i*CHUNK:(i+1)*CHUNK]
msg = json.dumps({"c": i, "n": total, "t": "test", "b": chunk, "m": "audio/webm"})
await ws.send(msg)
print(f" chunk {i+1}/{total} sent ({len(chunk)} chars)")
await asyncio.sleep(0.15) # 150ms между чанками — чтобы DPI не дрочил
# Final
await asyncio.sleep(0.15)
await ws.send(json.dumps({"c": -1}))
print(" final sent, waiting for response...")
try:
resp = await asyncio.wait_for(ws.recv(), timeout=30)
data = json.loads(resp)
print(f"Response: {data}")
except asyncio.TimeoutError:
print("TIMEOUT — no response")
asyncio.run(test())