원클릭으로
mtproto-proxy-architecture
// Current architecture and design rules for the Linux epoll-based Zig MTProto proxy.
// Current architecture and design rules for the Linux epoll-based Zig MTProto proxy.
| name | MTProto Proxy Architecture |
| description | Current architecture and design rules for the Linux epoll-based Zig MTProto proxy. |
This project is a production MTProto proxy in Zig with FakeTLS fronting, active anti-replay protection, and Linux-first deployment.
The project produces two binaries via build.zig:
| Binary | Source | Install Path | Purpose |
|---|---|---|---|
mtproto-proxy | src/main.zig | /opt/mtproto-proxy/mtproto-proxy | The proxy server |
mtbuddy | src/ctl/main.zig | /usr/local/bin/mtbuddy | Installer & control panel (TUI) |
Cross-compile for production: make build (or zig build -Doptimize=ReleaseFast -Dtarget=x86_64-linux -Dcpu=x86_64_v3).
epoll event loop handles socket I/O.Primary file: src/proxy/proxy.zig.
tls_domain.ServerHello (+ optional split/desync behavior).RPC_PROXY_REQ framing + CBC layerwritev flush.orderedRemove(0) hot-path shifts).Source tree: src/ctl/. Interactive TUI with raw terminal mode, arrow-key navigation, and Unicode box-drawing.
Key modules:
| Module | Purpose |
|---|---|
main.zig | CLI arg dispatch + interactive menu |
tui.zig | Terminal UI engine (raw mode, rendering) |
install.zig | Fresh proxy installation |
update.zig | Self-update from GitHub releases |
tunnel.zig | AmneziaWG tunnel + network namespace setup |
dashboard.zig | Monitoring dashboard installer |
recovery.zig | Service recovery & masking health |
uninstall.zig | Clean uninstall |
i18n.zig | English / Russian localization |
/opt/mtproto-proxy/
├── mtproto-proxy # proxy binary
├── config.toml # runtime configuration
├── env.sh # optional env vars (TAG, etc.)
└── monitor/ # dashboard assets (optional)
/usr/local/bin/mtbuddy # installer/control binary
/etc/systemd/system/mtproto-proxy.service
Version-pinned Telegram client connection behavior notes for proxy compatibility debugging.
Router skill for Zig-related tasks in this repository; points to local architecture, gotchas, and client-behavior skills.
Practical Zig/runtime pitfalls and invariants for this codebase after epoll rewrite.