Local SOCKS5 proxy for Telegram Desktop with HTTP support, auto-config, and auto-update
Go to file
y0sy4 b07bd29dae Update: new version release with binaries 2026-03-23 23:41:44 +03:00
.github Add PR template and issue config 2026-03-22 21:22:35 +03:00
android TG WS Proxy Go v2.0 - Clean release 2026-03-22 19:39:24 +03:00
cmd/proxy Update: new version release with binaries 2026-03-23 23:41:44 +03:00
internal Update: new version release with binaries 2026-03-23 23:41:44 +03:00
mobile Update: new version release with binaries 2026-03-23 23:41:44 +03:00
.gitignore Add releases to gitignore 2026-03-22 19:40:03 +03:00
CODE_OF_CONDUCT.md v2.0.1: Auto-update & Telegram auto-config 2026-03-22 20:11:45 +03:00
CONTRIBUTING.md v2.0.1: Auto-update & Telegram auto-config 2026-03-22 20:11:45 +03:00
FAQ.md Add FAQ and improve README for beginners 2026-03-22 21:21:16 +03:00
LICENSE TG WS Proxy Go v2.0 - Clean release 2026-03-22 19:39:24 +03:00
Makefile TG WS Proxy Go v2.0 - Clean release 2026-03-22 19:39:24 +03:00
README.md Update: new version release with binaries 2026-03-23 23:41:44 +03:00
README_EN.md TG WS Proxy Go v2.0 - Clean release 2026-03-22 19:39:24 +03:00
RELEASE_NOTES_v2.0.2.md v2.0.2: Auto-close duplicate instances on Windows 2026-03-22 21:33:35 +03:00
SECURITY.md Add SECURITY policy 2026-03-22 19:57:23 +03:00
go.mod TG WS Proxy Go v2.0 - Clean release 2026-03-22 19:39:24 +03:00
icon.ico TG WS Proxy Go v2.0 - Clean release 2026-03-22 19:39:24 +03:00
run.bat TG WS Proxy Go v2.0 - Clean release 2026-03-22 19:39:24 +03:00

README_EN.md

TG WS Proxy Go

Go Version License Release

Go rewrite of Flowseal/tg-ws-proxy

Local SOCKS5 proxy for Telegram Desktop written in Go

Speeds up Telegram by routing traffic through direct WebSocket connections to Telegram servers.


🚀 Quick Start

Installation

# Download binary from Releases
# Or build from source
go build -o TgWsProxy.exe ./cmd/proxy

Run

# Windows
start run.bat

# Linux/macOS
./TgWsProxy

# With options
./TgWsProxy --port 9050 --dc-ip 2:149.154.167.220

Configure Telegram Desktop

  1. SettingsAdvancedConnection TypeProxy
  2. Add proxy:
    • Type: SOCKS5
    • Server: 127.0.0.1
    • Port: 1080
    • Login/Password: empty (or your credentials if using --auth)

Or open link: tg://socks?server=127.0.0.1&port=1080


🔧 Command Line

./TgWsProxy [options]

Options:
  --port int        SOCKS5 port (default 1080)
  --host string     SOCKS5 host (default "127.0.0.1")
  --dc-ip string    DC:IP comma-separated (default "1:149.154.175.50,2:149.154.167.220,3:149.154.175.100,4:149.154.167.220,5:91.108.56.100")
  --auth string     SOCKS5 authentication (username:password)
  -v                Verbose logging
  --log-file string Log file path
  --log-max-mb float Max log size in MB (default 5)
  --buf-kb int      Buffer size in KB (default 256)
  --pool-size int   WS pool size (default 4)
  --version         Show version

Examples

# Without authentication
./TgWsProxy -v

# With authentication (protect from unauthorized access)
./TgWsProxy --auth "myuser:mypassword"

# Custom DC configuration
./TgWsProxy --dc-ip "2:149.154.167.220,4:149.154.167.220"

📦 Supported Platforms

Platform Architectures Status
Windows x86_64 Ready
Linux x86_64 Ready
macOS Intel + Apple Silicon Ready
Android arm64, arm, x86_64 📝 See android/README.md
iOS arm64 🚧 Planned

macOS Catalina (10.15) — supported! Use TgWsProxy_macos_amd64.


Features

  • WebSocket pooling — connection pool for low latency
  • TCP fallback — automatic switch when WS unavailable
  • MTProto parsing — DC ID extraction from init packet
  • SOCKS5 — full RFC 1928 support
  • Logging — with file rotation
  • Zero-copy — optimized memory operations
  • IPv6 support — via NAT64 and IPv4-mapped addresses
  • Authentication — SOCKS5 username/password

📊 Performance

Metric Value
Binary size ~6 MB
Memory usage ~10 MB
Startup time <100 ms
Latency (pool hit) <1 ms

Comparison: Python vs Go

Metric Python Go
Size ~50 MB ~6 MB
Dependencies pip stdlib
Startup ~500 ms ~50 ms
Memory ~50 MB ~10 MB

📱 Mobile Support

Android

See android/README.md for build instructions.

Quick build (requires Android SDK):

make android

iOS

Planned for future release.


🔒 Security

  • No personal data in code
  • No passwords or tokens hardcoded
  • .gitignore properly configured
  • Security audit: see SECURITY_AUDIT.md

🛠️ Build

# All platforms
make all

# Specific platform
make windows    # Windows (.exe)
make linux      # Linux (amd64)
make darwin     # macOS Intel + Apple Silicon
make android    # Android (.aar library)

📋 Configuration

Config file location:

  • Windows: %APPDATA%/TgWsProxy/config.json
  • Linux: ~/.config/TgWsProxy/config.json
  • macOS: ~/Library/Application Support/TgWsProxy/config.json
{
  "port": 1080,
  "host": "127.0.0.1",
  "dc_ip": [
    "1:149.154.175.50",
    "2:149.154.167.220",
    "3:149.154.175.100",
    "4:149.154.167.220",
    "5:91.108.56.100"
  ],
  "verbose": false,
  "log_max_mb": 5,
  "buf_kb": 256,
  "pool_size": 4,
  "auth": ""
}

🐛 Known Issues

  1. IPv6 — supported via IPv4-mapped addresses (::ffff:x.x.x.x) and NAT64
  2. DC3 WebSocket — may be unavailable in some regions

📈 Project Statistics

Metric Value
Lines of Go code ~2800
Files in repo 19
Dependencies 0 (stdlib only)
Supported platforms 4

🎯 Fixed Issues from Original

All reported issues from Flowseal/tg-ws-proxy are resolved:

  • #386 — SOCKS5 authentication
  • #380 — Too many open files
  • #388 — Infinite connection
  • #378 — Media not loading
  • #373 — Auto DC detection

See ISSUES_ANALYSIS.md for details.


📄 License

MIT License



Built with ❤️ using Go 1.21