From 872b47067aef23643d791691b0dc962ed7d4c318 Mon Sep 17 00:00:00 2001 From: Vladislav Yaroslavlev Date: Mon, 23 Feb 2026 17:22:56 +0300 Subject: [PATCH 1/5] Improve CLI help text with comprehensive options - Add version number to help header - Restructure help into USAGE, ARGS, OPTIONS, INIT OPTIONS, EXAMPLES sections - Include all command-line options with descriptions - Add usage examples for common scenarios --- src/main.rs | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/main.rs b/src/main.rs index 61debb9..119d3fd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -73,27 +73,36 @@ fn parse_cli() -> (String, bool, Option) { log_level = Some(s.trim_start_matches("--log-level=").to_string()); } "--help" | "-h" => { - eprintln!("Usage: telemt [config.toml] [OPTIONS]"); + eprintln!("telemt - Telegram MTProto Proxy v{}", env!("CARGO_PKG_VERSION")); eprintln!(); - eprintln!("Options:"); - eprintln!(" --silent, -s Suppress info logs"); - eprintln!(" --log-level debug|verbose|normal|silent"); - eprintln!(" --help, -h Show this help"); + eprintln!("USAGE:"); + eprintln!(" telemt [CONFIG] [OPTIONS]"); + eprintln!(" telemt --init [INIT_OPTIONS]"); eprintln!(); - eprintln!("Setup (fire-and-forget):"); - eprintln!( - " --init Generate config, install systemd service, start" - ); + eprintln!("ARGS:"); + eprintln!(" Path to config file (default: config.toml)"); + eprintln!(); + eprintln!("OPTIONS:"); + eprintln!(" -s, --silent Suppress info logs (equivalent to --log-level silent)"); + eprintln!(" --log-level Set log level [possible values: debug, verbose, normal, silent]"); + eprintln!(" -h, --help Show this help message"); + eprintln!(" -V, --version Print version number"); + eprintln!(); + eprintln!("INIT OPTIONS (fire-and-forget setup):"); + eprintln!(" --init Generate config, install systemd service, and start"); eprintln!(" --port Listen port (default: 443)"); - eprintln!( - " --domain TLS domain for masking (default: www.google.com)" - ); - eprintln!( - " --secret 32-char hex secret (auto-generated if omitted)" - ); - eprintln!(" --user Username (default: user)"); + eprintln!(" --domain TLS domain for masking (default: www.google.com)"); + eprintln!(" --secret 32-char hex secret (auto-generated if omitted)"); + eprintln!(" --user Username for proxy access (default: user)"); eprintln!(" --config-dir Config directory (default: /etc/telemt)"); - eprintln!(" --no-start Don't start the service after install"); + eprintln!(" --no-start Create config and service but don't start"); + eprintln!(); + eprintln!("EXAMPLES:"); + eprintln!(" telemt # Run with default config"); + eprintln!(" telemt /etc/telemt/config.toml # Run with specific config"); + eprintln!(" telemt --log-level debug # Run with debug logging"); + eprintln!(" telemt --init # Quick setup with defaults"); + eprintln!(" telemt --init --port 8443 --user admin # Custom setup"); std::process::exit(0); } "--version" | "-V" => { From a917dcc1624e3b73dca11f44e127d6b4e7bc8b86 Mon Sep 17 00:00:00 2001 From: Alexey <247128645+axkurcom@users.noreply.github.com> Date: Mon, 23 Feb 2026 18:34:23 +0300 Subject: [PATCH 2/5] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 662ec22..7abe548 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # ========================== # Stage 1: Build # ========================== -FROM rust:1.85-slim-bookworm AS builder +FROM rust:1.88-slim-bookworm AS builder RUN apt-get update && apt-get install -y --no-install-recommends \ pkg-config \ @@ -40,4 +40,4 @@ EXPOSE 443 EXPOSE 9090 ENTRYPOINT ["/app/telemt"] -CMD ["config.toml"] \ No newline at end of file +CMD ["config.toml"] From 9aed6c86317a49b4810eaf2a0a0e597bbf8e073b Mon Sep 17 00:00:00 2001 From: Alexey <247128645+axkurcom@users.noreply.github.com> Date: Mon, 23 Feb 2026 18:47:26 +0300 Subject: [PATCH 3/5] Update Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index dbdb024..fd1d892 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "telemt" -version = "3.0.12" +version = "3.0.13" edition = "2024" [dependencies] From e2e471a78c87b97811c79328b1e3678b9bbd19a6 Mon Sep 17 00:00:00 2001 From: Alexey <247128645+axkurcom@users.noreply.github.com> Date: Mon, 23 Feb 2026 19:43:03 +0300 Subject: [PATCH 4/5] Delete AGENTS.md --- AGENTS.md | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index dc582ae..0000000 --- a/AGENTS.md +++ /dev/null @@ -1,40 +0,0 @@ -# AGENTS.md - -** Use general system promt from AGENTS_SYSTEM_PROMT.md ** -** Additional techiques and architectury details are here ** - -This file provides guidance to agents when working with code in this repository. - -## Build & Test Commands -```bash -cargo build --release # Production build -cargo test # Run all tests -cargo test --lib error # Run tests for specific module (error module) -cargo bench --bench crypto_bench # Run crypto benchmarks -cargo clippy -- -D warnings # Lint with clippy -``` - -## Project-Specific Conventions - -### Rust Edition -- Uses **Rust edition 2024** (not 2021) - specified in Cargo.toml - -### Error Handling Pattern -- Custom [`Recoverable`](src/error.rs:110) trait distinguishes recoverable vs fatal errors -- [`HandshakeResult`](src/error.rs:292) returns streams on bad client for masking - do not drop them -- Always use [`ProxyError`](src/error.rs:168) from [`src/error.rs`](src/error.rs) for proxy operations - -### Configuration Auto-Migration -- [`ProxyConfig::load()`](src/config/mod.rs:641) mutates config with defaults and migrations -- DC203 override is auto-injected if missing (required for CDN/media) -- `show_link` top-level migrates to `general.links.show` - -### Middle-End Proxy Requirements -- Requires public IP on interface OR 1:1 NAT with STUN probing -- Falls back to direct mode on STUN/interface mismatch unless `stun_iface_mismatch_ignore=true` -- Proxy-secret from Telegram is separate from user secrets - -### TLS Fronting Behavior -- Invalid handshakes are transparently proxied to `mask_host` for DPI evasion -- `fake_cert_len` is randomized at startup (1024-4096 bytes) -- `mask_unix_sock` and `mask_host` are mutually exclusive From f86ced8e62fb50bb4ede3504510d93f3ad6d2374 Mon Sep 17 00:00:00 2001 From: Alexey <247128645+axkurcom@users.noreply.github.com> Date: Mon, 23 Feb 2026 19:43:34 +0300 Subject: [PATCH 5/5] Rename AGENTS_SYSTEM_PROMT.md to AGENTS.md --- AGENTS_SYSTEM_PROMT.md => AGENTS.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename AGENTS_SYSTEM_PROMT.md => AGENTS.md (100%) diff --git a/AGENTS_SYSTEM_PROMT.md b/AGENTS.md similarity index 100% rename from AGENTS_SYSTEM_PROMT.md rename to AGENTS.md