commit d32e4740259e41fa152480a432f54f9d5bf6e92e Author: SamNet-dev Date: Tue Feb 24 00:07:58 2026 -0600 feat: migrate MTProxyMax to Gitea + bump telemt engine to v3.0.13 - All install/README URLs point to git.samnet.dev - Container registry switched to Gitea - GitHub Actions converted to Gitea Actions - Engine bumped from v3.0.7 to v3.0.13 (TLS full cert, ME stability, pool hardswap) - Self-update mechanism stays on GitHub (pending account restoration) diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5db39a8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto +*.sh text eol=lf +LICENSE text eol=lf diff --git a/.gitea/workflows/build-engine.yml b/.gitea/workflows/build-engine.yml new file mode 100644 index 0000000..0c5542e --- /dev/null +++ b/.gitea/workflows/build-engine.yml @@ -0,0 +1,74 @@ +name: Build Telemt Engine + +on: + workflow_dispatch: + inputs: + telemt_commit: + description: 'Telemt commit hash to build from' + required: true + default: 'd38d7f2' + version_tag: + description: 'Version tag (e.g. 3.0.13-d38d7f2)' + required: true + default: '3.0.13-d38d7f2' + +env: + REGISTRY: git.samnet.dev + IMAGE_NAME: mtproxymax-telemt + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Set up QEMU (for ARM builds) + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ gitea.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Create Dockerfile + run: | + cat > Dockerfile <<'DEOF' + FROM rust:1-bookworm AS builder + ARG TELEMT_REPO=telemt/telemt + ARG TELEMT_COMMIT + RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/* + RUN git clone "https://github.com/${TELEMT_REPO}.git" /build + WORKDIR /build + RUN git checkout "${TELEMT_COMMIT}" + ENV CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_DEBUG=false + RUN cargo build --release && strip target/release/telemt 2>/dev/null || true && cp target/release/telemt /telemt + FROM debian:bookworm-slim + RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/* + COPY --from=builder /telemt /usr/local/bin/telemt + RUN chmod +x /usr/local/bin/telemt + STOPSIGNAL SIGINT + ENTRYPOINT ["telemt"] + DEOF + sed -i 's/^ //' Dockerfile + + - name: Lowercase owner + id: owner + run: echo "name=$(echo '${{ gitea.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" + + - name: Build and push multi-arch image + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + TELEMT_COMMIT=${{ github.event.inputs.telemt_commit }} + tags: | + ${{ env.REGISTRY }}/${{ steps.owner.outputs.name }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version_tag }} + ${{ env.REGISTRY }}/${{ steps.owner.outputs.name }}/${{ env.IMAGE_NAME }}:latest + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ac4dc3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__/ +*.pyc +.claude/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..959aafb --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 SamNet Technologies + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..50bc816 --- /dev/null +++ b/README.md @@ -0,0 +1,557 @@ +

+

MTProxyMax

+

The Ultimate Telegram MTProto Proxy Manager

+

+ One script. Full control. Zero hassle. +

+

+ Version + License + Engine + Platform + Bash + Docker +

+

+ Quick Start • + Features • + Comparison • + Telegram Bot • + CLI Reference • + Changelog +

+

+ +--- + +MTProxyMax is a full-featured Telegram MTProto proxy manager powered by the **telemt 3.x Rust engine**. It wraps the raw proxy engine with an interactive TUI, a complete CLI, a Telegram bot for remote management, per-user access control, traffic monitoring, proxy chaining, and automatic updates — all in a single bash script. + +MTProxyMax Main Menu + +```bash +sudo bash -c "$(curl -fsSL https://git.samnet.dev/SamNet-dev/MTProxyMax/raw/branch/main/install.sh)" +``` + +--- + +## Why MTProxyMax? + +Most MTProxy tools give you a proxy and a link. That's it. MTProxyMax gives you a **full management platform**: + +- 🔐 **Multi-user secrets** with individual bandwidth quotas, device limits, and expiry dates +- 🤖 **Telegram bot** with 17 commands — manage everything from your phone +- 🖥️ **Interactive TUI** — no need to memorize commands, menu-driven setup +- 📊 **Prometheus metrics** — real per-user traffic stats, not just iptables guesses +- 🔗 **Proxy chaining** — route through SOCKS5 upstreams for extra privacy +- 🔄 **Auto-recovery** — detects downtime, restarts automatically, alerts you on Telegram +- 🐳 **Pre-built Docker images** — installs in seconds, not minutes + +--- + +## 🚀 Quick Start + +### One-Line Install + +```bash +sudo bash -c "$(curl -fsSL https://git.samnet.dev/SamNet-dev/MTProxyMax/raw/branch/main/install.sh)" +``` + +The interactive wizard walks you through everything: port, domain, first user secret, and optional Telegram bot setup. + +### Manual Install + +```bash +curl -fsSL https://git.samnet.dev/SamNet-dev/MTProxyMax/raw/branch/main/mtproxymax.sh -o mtproxymax +chmod +x mtproxymax +sudo ./mtproxymax install +``` + +### After Install + +```bash +mtproxymax # Open interactive TUI +mtproxymax status # Check proxy health +``` + +--- + +## ✨ Features + +### 🛡️ FakeTLS V2 Obfuscation + +Your proxy traffic looks identical to normal HTTPS traffic. The **Fake TLS V2** engine mirrors real TLS 1.3 sessions — per-domain profiles, real cipher suites, dynamic certificate lengths, and realistic record fragmentation. The TLS handshake SNI points to a cover domain (e.g., `cloudflare.com`), making it indistinguishable from regular web browsing to any DPI system. + +**Traffic masking** goes further — when a non-Telegram client probes your server, the connection is forwarded to the real cover domain. Your server responds exactly like cloudflare.com would. + +--- + +### 👥 Multi-User Secret Management + +Each user gets their own **secret key** with a human-readable label: + +- **Add/remove** users instantly — config regenerates and proxy hot-reloads +- **Enable/disable** access without deleting the key +- **Rotate** a user's secret — new key, same label, old link stops working +- **QR codes** — scannable directly in Telegram + +--- + +### 🔒 Per-User Access Control + +Fine-grained limits enforced at the engine level: + +| Limit | Description | Example | +|-------|-------------|---------| +| **Max Connections** | Simultaneous TCP connections | `100` | +| **Max IPs** | Unique devices/IPs allowed | `5` | +| **Data Quota** | Total bandwidth cap | `10G`, `500M` | +| **Expiry Date** | Auto-disable after date | `2026-12-31` | + +```bash +mtproxymax secret setlimits alice 100 5 10G 2026-12-31 +``` + +--- + +### 📋 User Management Recipes + +
+Prevent Key Sharing + +```bash +mtproxymax secret setlimit alice ips 1 # Single person only +mtproxymax secret setlimit family ips 5 # Family of up to 5 devices +``` + +If someone with `ips 1` shares their link, the second device gets rejected automatically. + +
+ +
+IP Limit Tiers + +| Scenario | `max_ips` | +|----------|-----------| +| Single person, one device | `1` | +| Single person, multiple devices | `2-3` | +| Small family | `5` | +| Small group / office | `20-30` | +| Public/open link | `0` (unlimited) | + +
+ +
+Time-Limited Sharing Link + +```bash +mtproxymax secret add shared-link +mtproxymax secret setlimits shared-link 50 30 10G 2026-06-01 +``` + +When the expiry date hits, the link stops working automatically. + +
+ +
+Per-Person Keys (Recommended) + +```bash +mtproxymax secret add alice +mtproxymax secret add bob +mtproxymax secret add charlie + +# Each person gets their own link — revoke individually +mtproxymax secret setlimit alice ips 2 +mtproxymax secret setlimit bob ips 1 +mtproxymax secret setlimit charlie ips 3 +``` + +
+ +
+Disable, Rotate, Remove + +```bash +mtproxymax secret disable bob # Temporarily cut off +mtproxymax secret enable bob # Restore access + +mtproxymax secret rotate alice # New key, old link dies instantly + +mtproxymax secret remove bob # Permanent removal +``` + +
+ +--- + +### 🤖 Telegram Bot (17 Commands) + +Full proxy management from your phone. Setup takes 60 seconds: + +```bash +mtproxymax telegram setup +``` + +| Command | Description | +|---------|-------------| +| `/mp_status` | Proxy status, uptime, connections | +| `/mp_secrets` | List all users with active connections | +| `/mp_link` | Get proxy details + QR code image | +| `/mp_add