Skip to content

A lightweight dual stack TCP reverse proxy written in go

License

Notifications You must be signed in to change notification settings

AndersBallegaard/TCProxy

Repository files navigation

TCProxy

A lightweight dual stack TCP reverse proxy written in go

Capabilities

  • Reverse proxy all kinds of TCP based protocols

    • tested on the following
      • HTTP
      • HTTPS
      • SSH
  • IPv6 enable ipv4 only services

  • Supports multiple concurrent connections

Configuration

The application looks for a file called settings.yaml in the current working directory.

Config samples

HTTP proxy to ip

In this example we are listing on port 8080, and forwarding any connection the server is getting to 10.255.255.1:80 The proxy will always listen on both ipv6 and ipv4 for incomming connections

server:
  port: 8080
target:
  address: 10.255.255.1
  port: 80

HTTPS proxy with DNS

In this example we are acting as a proxy towards a proxmox web management interface. The server will lookup DNS names in the target address field. Note that the proxy is a direct passthough, so if the target server speaks HTTPS then it's passed though directly to the client. The server can't look inside the TLS connection for encrypted data

server:
  port: 8080
target:
  address: proxmox.internal
  port: 8006

SSH proxy

Like the HTTPS example, this does not break the security of the protocol itself. The configuration is also almost identical to the other examples because the proxy isn't application aware

server:
  port: 2222
target:
  address: 10.10.10.10
  port: 22

How to build

Make sure your version of go is new enough

go version
go version go1.22.2 linux/amd64 # You should have 1.22 or newer

Download the source code using git, and enter the directory

git clone https://github.com/AndersBallegaard/TCProxy.git
cd TCProxy

Run the following build command

go build .

Run the proxy

./TCProxy

About

A lightweight dual stack TCP reverse proxy written in go

Resources

License

Stars

Watchers

Forks

Languages