1. Installation and Script Execution Guide
2. Converting MTProto Proxy to VPN (Advanced)
3. Usage on Android
This guide explains how to use the script to convert MTProto proxy to VPN.
- Linux operating system (preferably Debian/Ubuntu-based)
- Root access
- Internet connection
git clone https://github.com/hesam-zahiri/Mtproto-vpn.gitchmod +x Mtproto-vpn.shsudo ./Mtproto-vpn.shInteractive menu:
1. Enable VPN
2. Disable VPN
3. Exit
- Check proxy status
- Check firewall
- View logs:
/var/log/redsocks.log
- TCP-only support
- Requires root access
- Linux server
- Root access
- MTProto proxy
sudo apt updatesudo apt install -y python3 python3-pip git redsocks iptablesgit clone https://github.com/alexbers/mtprotoproxy.gitcd mtprotoproxy
pip3 install -r requirements.txt
python3 mtprotoproxy.py
Edit /etc/redsocks.conf:
redsocks {
local_ip = 127.0.0.1;
local_port = 12345;
ip = [IP_PROXY_MTProto];
port = [PORT_PROXY];
type = socks5;
}Then:
sudo systemctl restart redsockssudo iptables -t nat -N REDSOCKS
sudo iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN
# ... (other iptables rules)
sudo iptables -t nat -A OUTPUT -p tcp -j REDSOCKSgit clone https://github.com/xjasonlyu/tun2socks.git
cd tun2socks
make
sudo ./tun2socks -device tun0 -proxy socks5://127.0.0.1:12345
sudo ip addr add 10.0.0.1/24 dev tun0
sudo ip link set tun0 upcurl --socks5 127.0.0.1:12345 ifconfig.me- Convert proxy to SOCKS5:
- You can use the MTProto-to-SOCKS script for conversion.
- Proxydroid Settings:
Host: Server address
Port: Port number
Type: SOCKS5
- Install Termux
- Execute the script
- Configure Android iptables
- Only TCP is supported
- Requires the app to remain active
- May not be compatible with some apps
MTProto is Telegram’s proprietary protocol.
It is not a general-purpose proxy like SOCKS or HTTPS.
This script, when executed, attempts to establish a connection to a server that only understands MTProto — which means it can only tunnel Telegram traffic through it.
So in this setup, even if we try to route all system traffic through it, nothing except Telegram will work.
However, there's an alternative approach using what's called “fake MTProto.”
Some tools can encrypt general traffic in a way that mimics MTProto (primarily to bypass DPI).
But as the name suggests, it’s not real MTProto.
It only appears to be MTProto on the surface (like fake TLS), while in the backend, it’s just a regular proxy.
This is essentially the same technique that tools like Shadowsocks, obfs, etc., use with WebSockets — where neither Telegram nor censorship systems can tell the difference.
Recently, I came across a project called telegram socks 5 proxy.
I haven’t tested it yet, but the developers claim to have wrapped MTProto inside a simplified WARP-style proxy.
Still, all of these solutions are limited to Telegram usage only — not for routing full system traffic.
The project is basic and needs further development, but the concept is interesting:
If we could somehow convert MTProto into a general-purpose proxy like SOCKS5, it could become much more useful.
However, that’s a highly complex task, because MTProto is an application-specific protocol.
It wasn’t designed to handle general TCP traffic.
The only way we could directly tunnel through MTProto would be to write a custom Telegram-like client that can perform authentication, key exchange, etc.
- GitHub: github.com/hesam-zahiri