telemt/telemt
MTProxy for Telegram on Rust + Tokio
Mixed signals — read the receipts
weakest axisnon-standard license (Other)
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
No critical CVEs, sane security posture — runnable as-is.
- ✓Last commit 1d ago
- ✓9 active contributors
- ✓Other licensed
Show all 7 evidence items →Show less
- ✓CI configured
- ✓Tests present
- ⚠Concentrated ownership — top contributor handles 78% of recent commits
- ⚠Non-standard license (Other) — review terms
What would change the summary?
- →Use as dependency Concerns → Mixed if: clarify license terms
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the "Forkable" badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/telemt/telemt)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card (1200×630)
This card auto-renders when someone shares https://repopilot.app/r/telemt/telemt on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: telemt/telemt
Generated by RepoPilot · 2026-05-09 · Source
🤖Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/telemt/telemt shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
🎯Verdict
WAIT — Mixed signals — read the receipts
- Last commit 1d ago
- 9 active contributors
- Other licensed
- CI configured
- Tests present
- ⚠ Concentrated ownership — top contributor handles 78% of recent commits
- ⚠ Non-standard license (Other) — review terms
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
✅Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live telemt/telemt
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/telemt/telemt.
What it runs against: a local clone of telemt/telemt — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in telemt/telemt | Confirms the artifact applies here, not a fork |
| 2 | License is still Other | Catches relicense before you depend on it |
| 3 | Default branch main exists | Catches branch renames |
| 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code |
| 5 | Last commit ≤ 31 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of telemt/telemt. If you don't
# have one yet, run these first:
#
# git clone https://github.com/telemt/telemt.git
# cd telemt
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of telemt/telemt and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "telemt/telemt(\\.git)?\\b" \\
&& ok "origin remote is telemt/telemt" \\
|| miss "origin remote is not telemt/telemt (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(Other)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"Other\"" package.json 2>/dev/null) \\
&& ok "license is Other" \\
|| miss "license drift — was Other at generation time"
# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
&& ok "default branch main exists" \\
|| miss "default branch main no longer exists"
# 4. Critical files exist
test -f "src/main.rs" \\
&& ok "src/main.rs" \\
|| miss "missing critical file: src/main.rs"
test -f "src/config/mod.rs" \\
&& ok "src/config/mod.rs" \\
|| miss "missing critical file: src/config/mod.rs"
test -f "Cargo.toml" \\
&& ok "Cargo.toml" \\
|| miss "missing critical file: Cargo.toml"
test -f "src/api/mod.rs" \\
&& ok "src/api/mod.rs" \\
|| miss "missing critical file: src/api/mod.rs"
test -f "src/cli.rs" \\
&& ok "src/cli.rs" \\
|| miss "missing critical file: src/cli.rs"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 31 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~1d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/telemt/telemt"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
⚡TL;DR
Telemt is a high-performance MTProxy server for Telegram written in Rust + Tokio that implements the official MTProto proxy protocol with advanced TLS-fronting, traffic masking, and DPI evasion. It supports Classic, Secure (dd prefix), and Fake TLS (ee prefix + SNI) modes, providing a drop-in replacement for official Telegram proxies with production-grade improvements like replay attack protection and configurable keepalives. Monolithic binary architecture: src/ (inferred) contains the main proxy engine with modular subsystems for TLS handling, MTProto codec, and Tokio async I/O. Config is TOML-based (config.toml). Docker and systemd integration in contrib/ and docker-compose files enable containerized or bare-metal deployment. Benchmarks in benches/crypto_bench.rs validate crypto performance.
👥Who it's for
Server operators and DevOps engineers deploying Telegram proxies in censored regions who need robust DPI evasion, low-latency protocol translation, and easy Docker/systemd deployment. Contributors are Rust developers interested in cryptography, async networking, and protocol implementation.
🌱Maturity & risk
Production-ready. The project has substantial stars, active CI/CD pipelines (.github/workflows/), comprehensive documentation in docs/, systemd/OpenBSD contrib configs, and benches/ for performance validation. Recent version 3.4.10 in Cargo.toml suggests active maintenance; however, exact commit recency is not visible in provided data.
Low-to-moderate risk. The dependency surface is large (~40+ direct deps) but uses well-maintained crates (tokio 1.42, rustls 0.23, hyper 1). Single-maintainer risk exists (telemt org); no breaking changes visible in provided structure. The crypto-heavy code (aes, sha2, hmac) requires careful auditing, and TLS-fronting complexity could harbor edge-case DPI detection vectors.
Active areas of work
Active development on TLS-fronting refinement (docs mention 'Fixed TLS ClientHello now available in official clients'); ongoing tuning documentation for high-load scenarios (docs/Advanced_settings/HIGH_LOAD.*); CodeQL security scanning enabled (.github/codeql/). No visible PR/issue data, but ROADMAP.md and IMPLEMENTATION_PLAN.md suggest features in flight.
🚀Get running
git clone https://github.com/telemt/telemt && cd telemt && cargo build --release && mv ./target/release/telemt /bin && chmod +x /bin/telemt. Or use the one-command install: curl -fsSL https://raw.githubusercontent.com/telemt/telemt/main/install.sh | sh
Daily commands: cargo build --release (default dev build: cargo build). For release with fat LTO: cargo build --release. Binary at ./target/release/telemt. Run: ./target/release/telemt (reads config.toml in current dir or configured path). Docker: docker-compose up (see docker-compose.yml, docker-compose.netfilter.yml, docker-compose.host-netfilter.yml). Systemd: sudo systemctl start telemt (contrib/systemd/telemt.service).
🗺️Map of the codebase
src/main.rs— Application entry point and initialization; every contributor must understand how the proxy starts upsrc/config/mod.rs— Configuration schema and loading logic; foundational for all runtime behaviorCargo.toml— Dependency manifest with heavy cryptographic and async runtime dependencies; critical for build and deploymentsrc/api/mod.rs— HTTP API layer for runtime management and control; entry point for operational dashboardssrc/cli.rs— Command-line interface and startup arguments; defines how operators run the proxy.github/instructions/Architecture.instructions.md— Team guidelines on architectural decisions; required reading for design reviews
🧩Components & responsibilities
- Transport Layer (socket2 + nix + network module) (Tokio TcpListener, socket2 SO_REUSEPORT, nix libc bindings) — Accepts inbound MTProxy connections, establishes upstream TLS to Telegram, multiplexes bidirectional traffic
- Failure mode: Connection drops; client fallback to direct Telegram or other proxy
- Cryptography Engine (aes, sha2, hmac, crc32) — Decrypts client MTProxy frames, encrypts responses, validates HMAC, comp
🛠️How to make changes
Add a New API Endpoint for Metrics
- Define the response model in src/api/model.rs with serde serialization (
src/api/model.rs) - Implement the endpoint handler function in a new or existing src/api/runtime_*.rs file (
src/api/runtime_stats.rs) - Register the route in src/api/mod.rs by adding it to the axum Router (
src/api/mod.rs) - Add integration test in src/api/tests/ or verify via HTTP client (
src/api)
Add a New Configuration Parameter
- Add field to config struct in src/config/mod.rs with serde attributes (
src/config/mod.rs) - Set default value in src/config/defaults.rs (
src/config/defaults.rs) - Add validation logic in src/config/load.rs if parameter requires runtime checks (
src/config/load.rs) - Document parameter in docs/Config_params/CONFIG_PARAMS.en.md and config.toml example (
config.toml)
Implement a Security Hardening Feature
- Define feature flag in Cargo.toml or add to security config struct (
Cargo.toml) - Add cryptographic or network logic to src/crypto or src/network (inferred) (
src/config/mod.rs) - Add test in src/config/tests/load_security_tests.rs to validate security invariants (
src/config/tests/load_security_tests.rs) - Verify with selftest in src/api/runtime_selftest.rs (
src/api/runtime_selftest.rs)
🔧Why these technologies
- Rust + Tokio — Memory safety without garbage collection; async runtime scales to thousands of concurrent proxy connections with minimal overhead
- AES-CTR, SHA2, HMAC, CRC32 — Cryptographic primitives required by Telegram MTProxy protocol and TLS obfuscation handshakes
- socket2 + nix — Low-level socket control for SO_REUSEPORT, TCP_NODELAY, and non-standard TLS ClientHello framing
- Axum (inferred from API endpoints) — Lightweight async HTTP framework for control plane and metrics endpoints
- Hot-reload config — Allows operators to adjust proxy behavior (routing, limits, security) without restarting long-running connections
⚖️Trade-offs already made
-
MTProxy obfuscation over pure VPN/shadowsocks
- Why: Telegram clients have native MTProxy support; less detectable than generic VPN
- Consequence: Proxy tied to Telegram protocol; not a general-purpose tunneling solution
-
FakeTLS framing for censorship evasion
- Why: TLS ClientHello mimicry defeats DPI that pattern-matches MTProxy headers
- Consequence: Higher CPU cost (double encryption); requires maintenance of TLS fingerprint fidelity
-
Rust instead of Go/C++
- Why: Memory safety; zero-copy networking; no GC pauses under load
- Consequence: Larger binary; slower iteration time during development
-
TOML configuration over etcd/Consul
- Why: Simpler deployment on single-node VPS; easier manual inspection and debugging
- Consequence: No built-in cluster state consistency; hot-reload requires coordinated API calls in distributed setups
🚫Non-goals (don't propose these)
- Does not implement L7 protocol filtering (only L4 proxy)
- Not a full VPN (no tunnel all traffic; Telegram-specific only)
- Does not provide client-side authentication or authorization (trusts upstream Telegram server)
- Not a load balancer (no automatic failover; relies on DNS or external orchestration)
- Does not store user data (stateless proxy; no caching or logging by default)
🪤Traps & gotchas
- LTO build on low-RAM systems: Release profile uses lto='fat' which requires ~2+ GB RAM; override to 'thin' in Cargo.toml on 1GB systems. 2. Config file location: Binary reads config.toml from current directory by default (inference); no explicit path in README—use absolute path or set env var if behavior differs. 3. TLS certificate generation: docs mention 'Fixed TLS ClientHello in official clients'—deploying outdated client versions will break TLS-fronting mode; users must update clients. 4. Crypto constant-time requirements: Dependencies like subtle (2.6) are used for timing-resistant comparisons; modifying crypto code without understanding this will introduce timing side-channels. 5. Signal handling via nix crate: Graceful shutdown on Ctrl+C is implemented via signal handlers (nix feature 'signal'); doesn't work identically on all OSes (Windows limitations). 6. IPv6 support conditional: 'Fast Mode' and IPv6 are configurable per upstream; disabling one affects performance profile. 7. No built-in metrics export: tracing is used for logging only, not Prometheus metrics—must inject metrics collection elsewhere.
🏗️Architecture
💡Concepts to learn
- MTProto Protocol (Telegram's binary proxy protocol) — Telemt's core responsibility is translating client MTProto into upstream MTProto; understanding MTProto's AEAD framing, nonce handling, and replay protection is mandatory for any protocol-level modification.
- TLS Fronting (SNI-based traffic masking) — Telemt's key differentiator is 'behavioral consistency to real' TLS—understanding ClientHello generation, Server Name Indication, and why fixed ClientHello matters for DPI evasion is critical for TLS mode work.
- Replay Attack Protection (nonce/IV reuse prevention) — Telemt implements replay protection per the MTProto spec; mishandling nonce state or connection reuse can leak encrypted traffic to attackers; see crypto dependencies (hmac, aes) and how they're keyed.
- Constant-Time Cryptography (timing side-channels) — Telemt uses subtle crate (2.6) for constant-time comparisons in crypto; any modification to authentication or MAC verification must preserve constant-time properties to avoid leaking secrets via timing.
- Deep Packet Inspection (DPI) evasion — Telemt's entire feature set (TLS-fronting, traffic masking to GitHub, configurable packet padding) exists to evade DPI detection; understanding DPI vectors and how each feature mitigates them informs architectural decisions.
- Tokio async cancellation and graceful shutdown — Telemt gracefully shuts down on Ctrl+C without dropping in-flight connections; Tokio's cancellation tokens and select! macro are used extensively; mishandling cancellation can cause resource leaks or silent failures.
- Zero-Copy I/O and zero_alloc crypto (Zeroize crate) — Telemt uses zeroize (1.8) to erase sensitive data (keys, session state) from memory; critical for proxy operators handling encryption keys; forgetting zeroize on sensitive structures creates side-channel risk.
🔗Related repos
TelegramMessenger/mtproto-proxy— Official Python MTProxy from Telegram; this repo's direct predecessor and specification reference for MTProto protocol compliance.ForcedMethod/mtproto-proxy-go— Alternative Go implementation of MTProxy; useful for comparing architectural choices and performance trade-offs vs. Rust/Tokio approach.alexmaco/mtproto-rs— Earlier Rust MTProto library; may contain MTProto codec patterns and encryption utilities relevant to understanding telemt's protocol layer.tokio-rs/tokio— Core async runtime dependency (v1.42); understanding tokio's executor and cancellation model is essential for debugging telemt's connection handling and graceful shutdown.rustls/rustls— TLS implementation dependency (v0.23); critical for understanding telemt's fake TLS mode and SNI fronting behavior, especially for DPI evasion validation.
🪄PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add integration tests for crypto operations in benches/crypto_bench.rs
The repo has crypto-heavy dependencies (aes, ctr, cbc, sha2, hmac, etc.) and a crypto_bench.rs file, but there's no evidence of corresponding integration tests. New contributors could add comprehensive tests validating crypto correctness (encryption/decryption round-trips, HMAC verification, KDF outputs) referenced in docs/Architecture/Middle-end/KDF-internals/. This prevents regressions in security-critical code.
- [ ] Create tests/crypto_integration_tests.rs with test cases for AES-CTR, CBC modes, HMAC, and SHA variants
- [ ] Add tests validating KDF implementation against vectors documented in MIDDLE-END-KDF.en.md
- [ ] Test zeroize behavior on sensitive data structures to ensure memory safety
- [ ] Add test case to verify CRC32/CRC32C checksums match expected values
- [ ] Update Cargo.toml to include integration test dependencies if needed
Implement specific GitHub Action workflow for security vulnerability scanning (SBOM/cargo-audit)
The repo has .github/workflows/codeql.yml for static analysis but no automated dependency vulnerability scanning. Given the extensive cryptographic and network dependencies, a cargo-audit or cargo-bom workflow would catch supply-chain risks. This is critical for a security-focused proxy project.
- [ ] Create .github/workflows/security-audit.yml that runs cargo-audit on each PR and main branch push
- [ ] Add cargo-bom or cargo-generate-sbom step to generate Software Bill of Materials in releases
- [ ] Configure the workflow to fail on high/critical vulnerabilities, warn on medium
- [ ] Add deny.toml configuration (already exists at .cargo/deny.toml) validation to the workflow
- [ ] Document the security scanning process in CONTRIBUTING.md
Add configuration validation tests in tests/ for docs/Config_params/CONFIG_PARAMS.en.md
The repo has extensive configuration documentation (CONFIG_PARAMS.en.md and .ru.md) and a config.toml file, but no tests validating that config parsing matches documented behavior. New contributors could create schema validation tests ensuring invalid configs are rejected and valid ones produce expected runtime values.
- [ ] Create tests/config_validation_tests.rs with test cases for each parameter documented in CONFIG_PARAMS.en.md
- [ ] Test edge cases: missing required fields, invalid types, out-of-range values for port/timeout configs
- [ ] Validate TLS configuration parameters load correctly (referenced in TLS_FRONT_PROFILE_FIDELITY.en.md)
- [ ] Add tests for systemd/contrib configuration files (telemt.service, system-user-telemt.conf)
- [ ] Test that config.toml parses and produces expected values matching Cargo.toml defaults
🌿Good first issues
- Add integration tests for all three MTProto modes (classic, secure, fake_tls) in tests/ directory. Currently only benches/crypto_bench.rs exists; missing end-to-end test coverage for protocol correctness and mode switching.
- Document the complete MTProto packet format and codec logic in docs/Architecture/ (e.g., docs/Architecture/MTProto_Codec.en.md). README mentions 'fully implements the official Telegram proxy algo' but no architectural doc explains the wire format, AEAD framing, or replay protection mechanism.
- Create a grafana dashboard + Prometheus exporter for telemt metrics. The repo uses tracing/ but has no instrumentation for connection counts, latency histograms, or upstream health; DevOps teams need this for production monitoring.
⭐Top contributors
Click to expand
Top contributors
- @axkurcom — 78 commits
- @lie-must-die — 8 commits
- @zarv1k — 4 commits
- @astronaut808 — 3 commits
- @Dimasssss — 2 commits
📝Recent commits
Click to expand
Recent commits
8c303ab— Merge pull request #765 from Misha20062006/patch-2 (axkurcom)f70c293— Correct saving instructions in QUICK_START_GUIDE.ru.md (Misha20062006)9ee341a— Merge pull request #757 from Dimasssss/docs (axkurcom)f76c847— Update CONFIG_PARAMS.en.md (Dimasssss)1aaa9c0— Update CONFIG_PARAMS.ru.md (Dimasssss)e50026e— Update README.md (axkurcom)7106f38— Update Cargo.lock (axkurcom)2a69447— Update Cargo.toml (axkurcom)b98cd37— TLS Full Certificate Budget Bookkeeping + Hot-path Cleanup and Timeout Invariants + IP-Tracker refactoring + Shard TLS F (axkurcom)8b62965— Stabilize unknown-DC symlink race test setup (axkurcom)
🔒Security observations
- High · Incomplete Cargo.toml Profile Configuration —
Cargo.toml (line ending with '[profile.releas'). The Cargo.toml file appears to be truncated at '[profile.releas' indicating incomplete release profile configuration. This may result in suboptimal security optimizations such as missing symbol stripping, LTO, or panic handling settings that are critical for production binaries. Fix: Complete the release profile configuration with proper settings: [profile.release] with opt-level = 3, lto = true, codegen-units = 1, strip = true, and panic = 'abort'. Review and ensure all security-relevant compiler flags are properly set. - Medium · Outdated Edition Specification —
Cargo.toml (line 3: edition = '2024'). Cargo.toml specifies edition = '2024', which does not exist. Valid Rust editions are 2015, 2018, and 2021. This is likely a typo and may cause build failures or unexpected behavior. Fix: Change to edition = '2021' which is the latest stable Rust edition and provides improved safety features and idioms. - Medium · Permissive tmpfs Permissions in Docker Compose —
docker-compose.yml (tmpfs section). The tmpfs volume for /etc/telemt is configured with mode=1777 (world-writable sticky bit), which allows any user to write to this directory. While the container runs with minimal privileges, this is unnecessarily permissive. Fix: Change mode=1777 to mode=0755 to restrict write permissions to the owner only, or mode=0770 if group access is needed. Review the actual permission requirements for the telemt application. - Medium · Potential Information Disclosure via Health Check —
docker-compose.yml (healthcheck section). The healthcheck command executes '/app/telemt healthcheck' which could potentially expose version information, configuration details, or error messages that aid attackers in reconnaissance. Fix: Ensure the healthcheck command returns minimal output (e.g., exit code only). Review telemt's healthcheck implementation to confirm it doesn't leak sensitive information. Consider redirecting output to /dev/null. - Medium · Exposed API Port Without Authentication Context —
docker-compose.yml (ports: 127.0.0.1:9090, 127.0.0.1:9091). Docker Compose exposes ports 9090 and 9091 (localhost-bound API ports) but there is no visible authentication mechanism documented in the provided configuration. If these ports are ever exposed beyond localhost, authentication vulnerabilities could be exploited. Fix: Ensure API endpoints on ports 9090/9091 implement strong authentication (JWT, mTLS, or API keys). Document authentication requirements. Consider adding API rate limiting and request validation. If ports should only be accessible locally, enforce this at the network level. - Low · Dependency on Deprecated MD5 and SHA1 —
Cargo.toml (dependencies: md-5, sha1). The codebase includes dependencies on md-5 (0.10) and sha1 (0.10), which are cryptographically weak algorithms. While these may be necessary for Telegram protocol compatibility, their usage should be minimized and isolated. Fix: Document why MD5 and SHA1 are required. Ensure they are only used in legacy protocol support contexts and never for new security-sensitive operations. Prefer SHA2 (already included) for any new cryptographic requirements. Add code comments explaining the necessity of weak algorithms. - Low · No Explicit Security Policy File —
Repository root. The codebase lacks a SECURITY.md or security policy file defining vulnerability disclosure procedures, supported versions, and security update timelines. Fix: Create a SECURITY.md file documenting: vulnerability disclosure process, supported versions receiving updates, security contact information, and expected response/patch timelines. This helps researchers responsibly report security issues. - Low · Cargo.lock Not in .gitignore (for Library) —
.gitignore. While Cargo.lock is appropriately committed for binary projects, if this is also distributed as a library, committed lock files can cause dependency resolution issues for downstream consumers. Fix: Verify the project type. For binary-only projects (which telemt
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.