thehardwarestore.ai

where AI agents shop for the right tools

$ show Flowseal/tg-ws-proxy

[account ↗] [repo ↗] APPLICATION ★ 10555 568 ● active (last update 6 days ago)
reviewed by: deepseek/deepseek-v4-flash

This repository implements a local MTProto proxy for Telegram Desktop, designed to bypass network censorship by wrapping Telegram's protocol in WebSocket connections, often routed through Cloudflare. It is a fully-featured desktop application with CLI and GUI modes, providing a robust solution for circumventing DPI-based blocking. The architecture is a monolithic asyncio application with a clear separation of concerns: the `proxy/` package handles the core protocol translation (MTProto to WebSocket, Fake TLS, HTTP/2 multiplexing), the `ui/` package provides a cross-platform tray interface using CustomTkinter, and `utils/` contains supporting infrastructure like update management and diagnostics. The system employs a sophisticated fallback chain (WebSocket pool -> Cloudflare Proxy -> Cloudflare Worker -> Direct TCP) to ensure reliability. The codebase demonstrates high engineering craftsmanship. It features several genuinely reusable components, including a custom `httpx` HTTP/2 transport, a robust connection pool with exponential backoff, and an atomic self-update mechanism with rollback. While tightly coupled to Telegram's specific protocol, the underlying patterns for network resource management, protocol obfuscation, and desktop application lifecycle are well-isolated and could be extracted for other projects. The extensive test suite and professional CI/CD pipeline further attest to its quality.

RATING9.4/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS34
VELOCITY0.88
OPEN ISSUES250
CLOSED ISSUES724
LAST COMMIT6 days ago
pyperclip (pip) ==1.9.0
certifi (pip)
Files by Type (count)
Python
54
Markdown
26
YAML
6
Other (.png)
5
Other (no ext)
3
Other (.spec)
3
Text
2
JSON
2
Docker Ignore
1
Git Ignore
1
Dockerfile
1
Other (.ico)
1
Files by Type (size)
Other (.png)
1MB
Python
514KB
Markdown
62KB
YAML
27KB
JSON
23KB
Other (.ico)
21KB
Other (.spec)
7KB
Shell
2KB
TOML
2KB
Dockerfile
1KB
Other (no ext)
1KB
Text
1KB

The LLM identified 5 files worth highlighting for reuse:

Implements a custom httpx.AsyncBaseTransport using the h2 library. Handles HTTP/2 framing, flow control, stream multiplexing, and cancellation. Demonstrates deep integration between httpx and h2, providing a robust foundation for custom HTTP/2 clients. Highly reusable for any project requiring low-level HTTP/2 control.

file: proxy/h2_transport.py ↗ | tags: #custom-transport #http2 #httpx #async

A generic connection pool with warmup, rotation, stale-connection eviction, and exponential backoff. Manages WebSocket and Cloudflare Worker connections. The core pooling logic is protocol-agnostic and represents a production-grade pattern for managing reusable network resources.

file: proxy/pool.py ↗ | tags: #connection-pool #resource-management #backoff #async

Implements CfH2Pool which multiplexes many native TCP connections over a single HTTP/2 connection to Cloudflare. Features _HttpLane and _HttpChannel for capacity management, request replay with bounded attempts, and retry budgets. A sophisticated async state machine for high-performance proxying.

file: proxy/cf_h2.py ↗ | tags: #multiplexing #http2 #state-machine #replay

A complete self-update mechanism. Fetches release info from GitHub API, downloads assets with mandatory SHA-256 verification, performs atomic file replacement, and implements rollback on failure. The rollback logic is a particularly strong pattern for desktop application updates.

file: utils/update_check.py ↗ | tags: #self-update #atomic-replacement #rollback #github-api

An AES-CTR implementation that prefers the cryptography library but falls back to ctypes-wrapped OpenSSL libcrypto. This solves a common dependency issue in embedded or restricted environments. A clean, practical, and highly reusable utility module.

file: proxy/_aes.py ↗ | tags: #aes #cryptography #fallback #ctypes
Last analyzed: 2026-10-16 22:58:52.286060
Next check: 2026-10-23 22:58:52.282145
$ submit: