TCP/UDP Proxy

Forward TCP or UDP traffic from a local port to a remote target

A portable shell script that forwards TCP or UDP traffic from a local port to a remote target. It auto-detects an available runtime and finds an open port automatically.

Quick Start

SSH-style shorthand:

curl -fL windpoly.run/tcp-proxy.sh | sh -s -- 8080:example.com:80

Or with named options:

curl -fL windpoly.run/tcp-proxy.sh | sh -s -- --listen 8080 --target example.com:80

Features

  • Supports both TCP and UDP forwarding (--proto udp)
  • SSH-style shorthand: LOCAL_PORT:HOST:REMOTE_PORT
  • Automatic port detection — tries the next port if the chosen one is in use (up to 10 attempts)
  • Binds to 0.0.0.0 so you can access it from other devices on your network
  • POSIX sh compatible — no bash required

Example

Proxy local port 5432 to a remote PostgreSQL server:

curl -fL windpoly.run/tcp-proxy.sh | sh -s -- 5432:db.example.com:5432

Forward UDP traffic on port 5000 to a DNS server:

curl -fL windpoly.run/tcp-proxy.sh | sh -s -- --listen 5000 --target 8.8.8.8:53 --proto udp

Supported Runtimes

The script tries the following in order and uses the first one found:

RuntimeRequirementCommand Used
socatsocat installedsocat TCP-LISTEN:... TCP:...
Dockerdocker daemondocker run alpine/socat

Download

Download tcp-proxy.sh