Tunneling Minecraft traffic to HTTP proxy
Suppose that I have a HTTP proxy server running at localhost:1080
, my Minecraft server is running at 123.123.123.123:25565
, and I want the tunnel to listen at port 1234
so that I can connect to localhost:1234
on my Minecraft client and the traffic will be tunneled to my proxy.
Install socat
sudo apt install socat
Create the tunnel:
socat TCP-LISTEN:<client port>,bind=localhost,fork PROXY:localhost:<server ip>:<server port>,proxyport=<proxy port>
For this example, it would be:
socat TCP-LISTEN:1234,bind=localhost,fork PROXY:localhost:123.123.123.123:25565,proxyport=1080
This command sets up a TCP listener on localhost:1234
, and any incoming connection will be forwarded through the HTTP proxy at localhost:1080
to the server at 123.123.123.123:25565
.
Now, launch the Minecraft client and add a server with address localhost:1234
and enjoy!
Shell script version:
server_ip="example.example.com"
server_port="25565"
client_port="1234"
proxy_port="1080"
echo server_ip: ${server_ip}
echo server_port: ${server_port}
echo client_port: ${client_port}
echo proxy_port: ${proxy_port}
socat TCP-LISTEN:${client_port},bind=localhost,fork PROXY:localhost:${server_ip}:${server_port},proxyport=${proxy_port}