Skip to content

About

Installer and live TUI manager for the new Telegram WEB proxy (tproxy-server + MTProxy + Caddy); split mode over NetBird/WireGuard

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

tg-webproxy

Lint License: GPL-3.0 bash platform

One-command installer and live management CLI for the new Telegram WEB proxy: MTProto traffic is masked inside ordinary HTTPS/WebSocket connections to your domain, appearing to the network as a standard website. It wraps the official telegramdesktop/tproxy-server, adding pre-flight checks, secret generation, a randomized disguise website, a live TUI dashboard (tgwebproxy), self-update, and an optional split mode (Caddy + relay on one host, MTProxy on another over NetBird/WireGuard). Fully English UI.

Installation

bash <(wget -qO- https://raw.githubusercontent.com/AA-141/TG-WebProxy/main/tg-webproxy.sh)

Prerequisites:

  • VPS on x86_64 running Ubuntu 22.04+ or Debian 12+, systemd, root access;
  • Public IPv4 and open ports 80 and 443;
  • A dedicated domain/subdomain with an A-record pointing to this server. The domain remains an accessible website — no CDN or Cloudflare proxy (orange cloud) in front of it;
  • Telegram reachability from server. The installer first verifies connectivity to Telegram data centers and core.telegram.org; if blocked by the hosting provider's network, it immediately advises choosing another server before compiling.

The installer interactively prompts for the domain, Let's Encrypt email, secret, connection carrier mode, and optional sponsored channel tag (@MTProxybot AD_TAG), with sensible defaults on Enter. Domain DNS records are validated against the server IP immediately upon entry. Compilation runs in the background with a live single-line progress indicator, and the full build log is written to /var/log/tgwebproxy-install.log. At completion, client connection links (tg://webproxy?server=…&secret=…) are generated.

For automated / unattended installations via environment variables, custom website templates, or pinning upstream commits, see docs/install-variants.md.

How It Works

Internet ──:443/:80──▶ Caddy (TLS, Let's Encrypt) ──▶ tproxy-server (relay, 127.0.0.1:8080)
                                                              │
                                                              ▼
                                                     MTProxy (127.0.0.1:2398) ──▶ Telegram DC

Only ports 80 and 443 are publicly exposed. The relay decrypts nothing: it translates client HTTPS requests or WebSocket streams back into raw MTProto streams and forwards them to the local stock MTProxy. All components are installed and configured cleanly via systemd.

What tg-webproxy.sh adds over upstream:

  • Comprehensive pre-flight checks: root privileges, CPU architecture, DNS propagation, port availability, and CDN detection;
  • Unique randomized cover website generated per installation to prevent active-probing fingerprinting;
  • Full support for all carrier modes (https, https-lanes, websocket, websocket-lanes, all) with MTProxy secret synchronization;
  • Direct integration with @MTProxybot AD_TAG for sponsored channel promotion;
  • Caddy log filter to prevent capability tokens from leaking into system logs;
  • Workarounds for upstream build and permission bugs;
  • Interactive management utility tgwebproxy with live dashboard, self-update, and split mode;
  • Complete English interface for installer, management dashboard, and generated website.

Management

After installation, running tgwebproxy without arguments opens the interactive dashboard, auto-refreshing live:

╭────────────────────────────────────────────────────────────────────────────╮
│ TELEGRAM WEB PROXY                                        tgwebproxy 1.4.2 │
│ proxy.example.com                                                ● running │
╰────────────────────────────────────────────────────────────────────────────╯

  SERVICES                              CONNECTIONS
  ● caddy   ● relay   ● mtproxy         clients → caddy      12
  ● firewall   ● refresh                caddy → relay        12
  relay: healthz ok  ·  readyz ready    relay → mtproxy      12
                                        sessions 12  ·  streams 31  ·  refused 0

  TRAFFIC                               SETTINGS
  relay     ↑ 254MB   ↓ 3GB             transport   all  (4 profiles)
  :443      in 300MB  out 3GB           AD_TAG      e3045596…0562
  ens3      today 3 GiB / 300 MiB       relay       52a5feb  from 2026-09-03
            month 41 GiB / 4 GiB

  CONNECTION                MAINTENANCE               UTILITY
  1  Links                  4  Restart services       7  Update utility
  2  Connection mode        5  Logs                   8  Uninstall
  3  AD_TAG                 6  Update relay           0  Exit

  s  Detailed status        w  Live monitor

The same actions are available directly via CLI commands: tgwebproxy status, link, mode, adtag, logs, restart, update, version, self-update, uninstall. Complete documentation for every screen and command: docs/cli.md.

Updates

  • tgwebproxy update: updates the relay from the upstream repository with automatic rollback on failure.
  • tgwebproxy self-update: updates the utility script from the repository.
  • Re-running the installer is safe: previous domain, email, secret, mode, and AD_TAG are automatically filled as defaults, and the website in /srv/tproxy-site is preserved.

Split Mode: Relay and MTProxy on Separate Hosts

By default, all components run on a single server, which is ideal for a single VPS. If you want to host multiple frontend domains pointing to one MTProxy backend, or swap frontends when blocked without touching MTProxy, the installer supports two roles connected via NetBird or WireGuard:

  • front: Caddy and relay. A systemd-socket-proxyd listens on 127.0.0.1:2398 and tunnels traffic to the backend host;
  • backend: MTProxy only, with the port firewall-restricted strictly to tunnel addresses.

For setup instructions and details, see docs/split-mode.md.

Troubleshooting

The installer diagnoses failures automatically: upstream test errors, relay readiness timeouts, apt issues, or MTProxy binary permissions, printing service status and log paths. Common scenarios and solutions: docs/troubleshooting.md.

Security & Camouflage

  • The secret is passed to the upstream installer via stdin and never appears in process lists (ps).
  • info.env with secrets is stored in /opt/tgwebproxy with 0600 permissions; profiles.json is loaded securely via systemd LoadCredential.
  • Caddy access logs are filtered: capability URIs, request headers, and full client IP addresses are not logged.
  • Do not put a CDN proxy in front of the domain, do not add file_server, redir, or respond rules to the Caddyfile, do not enable HTTP/3, and do not combine multiple proxy domains into a single certificate. Reasons are detailed in docs/upstream-notes.md.

Uninstallation

tgwebproxy uninstall            # removes services, units, configs, relay, and MTProxy; website and certificates kept
tgwebproxy uninstall --purge    # also purges website, SSL certificates, Go toolchain, and service users

If Caddy existed on the server prior to installation, its original Caddyfile and systemd service are restored from backup.

License

GPL-3.0. Upstream tproxy-server and MTProxy are distributed under their respective licenses.

About

Installer and live TUI manager for the new Telegram WEB proxy (tproxy-server + MTProxy + Caddy); split mode over NetBird/WireGuard

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages