How telemt/telemt works
Telemt is a Rust/Tokio Telegram MTProto proxy. The primary workflow accepts client connections, negotiates an MTProto proxy mode, and relays traffic directly or through configured middle-end proxies. It also supports TLS fronting, optional web traffic masking, runtime configuration and user administration, and operational metrics. The graph combines README-documented capabilities with sampled entry-point and configuration/API code; most proxy and web internals are represented at subsystem level because their implementation was not sampled.
Main entry points: orchestrator.rs Runtime orchestration · listeners.rs Proxy listeners · handshake.rs Client handshake · relay.rs Traffic relay
Components 23
Runtime and config
- Process entry
src/main.rs - Runtime orchestration
src/maestro/orchestrator.rs - Config loading
src/config/load/pipeline.rs - Hot reload
src/config/hot_reload.rs
MTProto proxy
- Proxy listeners
src/maestro/listeners.rs - Client handshake
src/proxy/handshake.rs - MTProto framing
src/protocol/mod.rs - Traffic relay
src/proxy/relay.rs
Upstream transport
- Upstream selection
src/transport/upstream.rs - Middle-end pool
src/transport/middle_proxy/pool.rs
Web and fronting
- Traffic masking
src/proxy/masking.rs - TLS fronting
src/tls_front/mod.rs - Web runtime
src/web/manager.rs - Web trace store
src/web/trace/store.rs
Operations
- Control API
src/api/mod.rs - User operations
src/api/handler/user_routes.rs - Statistics
src/stats/mod.rs - Metrics endpoint
src/metrics/web.rs
Other components
- Operator
- Telegram client
- Telegram network
- Decoy web server
- Config files
Connections 26
- Operator → Process entry: starts process
- Process entry → Runtime orchestration: runs server
- Runtime orchestration → Config loading: loads config
- Config files → Config loading: reads settings
- Runtime orchestration → Proxy listeners: starts listeners
- Operator → Control API: manages proxy
- Control API → User operations: dispatches user routes
- User operations → Config files: reads and updates
- Operator → Config files: provides settings
- Telegram client → Proxy listeners: connects
- Proxy listeners → Client handshake: accepts connection
- Client handshake → MTProto framing: negotiates framing
- Client handshake → TLS fronting: handles fake TLS
- MTProto framing → Traffic relay: passes framed traffic
- Traffic relay → Upstream selection: requests route
- Upstream selection → Telegram network: connects directly
- Upstream selection → Middle-end pool: selects pooled route
- Middle-end pool → Telegram network: forwards traffic
- Proxy listeners → Traffic masking: forwards unrecognized traffic
- Traffic masking → Decoy web server: relays web traffic
- Runtime orchestration → Hot reload: coordinates reload
- Control API → Runtime orchestration: submits reload
- Traffic relay → Statistics: records activity
- Metrics endpoint → Statistics: renders measurements
- Operator → Metrics endpoint: scrapes metrics
- Web runtime → Web trace store: stores traces