A Node.js CLI tool that verifies Telegram MTProto proxies by actually communicating with Telegram servers using the official TDLib API.
- ✅ Real Verification: Verifies proxies by actually communicating with Telegram servers, not just TCP connections
- ✅ Uses TDLib: Official Telegram Database Library API (
addProxyandpingProxymethods) - ✅ No Authorization Required: Works before login - no phone number or bot token needed
- ✅ Multiple URL Formats: Supports both
tg://proxy?andhttps://t.me/proxy?formats - ✅ Smart Secret Handling: Auto-detects and converts hex/base64 secrets
- ✅ Detailed Error Messages: Shows specific failure reasons (connection refused, timeout, invalid secret, etc.)
- ✅ Scriptable: Proper exit codes for automation
- ✅ Cross-Platform: Works on Windows, Linux, and macOS
git clone https://github.com/AmirTahaMim/telegram-mtproto-proxy-checker.git
cd telegram-mtproto-proxy-checker
npm installnpm installThis will install:
tdl- Node.js wrapper for TDLibtdl-tdlib-addon- TDLib native bindingsprebuilt-tdlib- Pre-built TDLib binaries for your platform
Command line argument:
node index.js "https://t.me/proxy?server=IP&port=PORT&secret=SECRET"Using tg:// format:
node index.js "tg://proxy?server=IP&port=PORT&secret=SECRET"From stdin:
# Linux/macOS
echo "https://t.me/proxy?server=IP&port=PORT&secret=SECRET" | node index.js
# Windows PowerShell
"https://t.me/proxy?server=IP&port=PORT&secret=SECRET" | node index.jsDebug mode (detailed output):
node index.js --debug "https://t.me/proxy?server=IP&port=PORT&secret=SECRET"OK
NO: CONNECTION_REFUSED: Proxy server refused the connection (server might be down or port is closed)
NO: DNS_ERROR: Cannot resolve server hostname to IP address
NO: TIMEOUT: Proxy did not respond within 15 seconds
NO: Response hash mismatch
NO: INVALID_SECRET: Secret format is invalid or incorrect
INVALID_SECRET
0- Proxy verification successful (OK)1- Invalid secret format (INVALID_SECRET)2- Proxy verification failed (NO with detailed error)
$ node index.js "https://t.me/proxy?server=163.5.31.10&port=8443&secret=EERighJJvXrFGRMCIMJdCQRueWVrdGFuZXQuY29tZmFyYWthdi5jb212YW4ubmFqdmEuY29tAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
OK$ node index.js "https://t.me/proxy?server=invalid.example.com&port=443&secret=abcd1234"
NO: DNS_ERROR: Cannot resolve server hostname to IP address$ node index.js --debug "https://t.me/proxy?server=example.com&port=443&secret=secret123"
[DEBUG] Parsed URL:
[DEBUG] Server: example.com
[DEBUG] Port: 443
[DEBUG] Secret (raw): secret123...
[DEBUG] Secret format: base64
[DEBUG] Connected to TDLib
[DEBUG] Server: example.com
[DEBUG] Port: 443
[DEBUG] Secret (hex, first 32 chars): b2b9b2b9b2b9b2b9b2b9b2b9b2b9b2b9...
[DEBUG] Secret length: 9 bytes
NO: CONNECTION_REFUSED: Proxy server refused the connection- URL Parsing: Extracts
server,port, andsecretfrom the proxy URL - Secret Normalization:
- If secret contains only hex characters
[0-9a-fA-F], treats it as hex - Otherwise, treats it as URL-safe Base64
- Normalizes Base64:
-→+,_→/ - Adds padding (
=) to make length a multiple of 4 - Decodes to raw bytes and converts to lowercase hex string
- If secret contains only hex characters
- TDLib Client: Creates a TDLib client (no authorization required)
- Add Proxy: Calls
addProxywith the normalized secret - Ping Proxy: Calls
pingProxyto verify actual connectivity to Telegram servers - Result: Returns success or detailed error message
| Error Message | Meaning |
|---|---|
CONNECTION_REFUSED |
Proxy server is not accepting connections (down or firewall blocking) |
DNS_ERROR |
Cannot resolve the server hostname |
TIMEOUT |
Proxy did not respond within 15 seconds |
Response hash mismatch |
Proxy is reachable but secret is incorrect or proxy misconfigured |
INVALID_SECRET |
Secret format cannot be decoded (invalid hex or base64) |
INVALID_PORT |
Port number is invalid or out of range |
INVALID_SERVER |
Server address is invalid |
- Node.js ≥ 18
- Platform: Windows, Linux, or macOS (TDLib binaries are platform-specific)
- Internet Connection: Required for initial TDLib download and proxy verification
- Uses TDLib's
addProxyandpingProxymethods - Proxy verification works before authorization (no login required)
- Timeout is set to 15 seconds for proxy ping
- Supports long Fake-TLS Base64 secrets
- Automatically handles both hex and base64 secret formats
- TDLib binaries are automatically downloaded via
prebuilt-tdlibpackage
- Ensure
prebuilt-tdlibpackage is installed:npm install prebuilt-tdlib - On Windows, the
tdjson.dllwill be automatically downloaded
- Run
npm installto install all dependencies
- Check if the proxy server is accessible
- Verify the server IP/hostname and port are correct
- Some proxies may have longer response times - this is normal
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
MIT License - see LICENSE file for details