- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .gitignore | ||
| certloader.go | ||
| go.mod | ||
| LICENSE | ||
| main.go | ||
| main_test.go | ||
| misc.go | ||
| README.md | ||
| revproxy.go | ||
revproxy
Simple reverse proxy for TCP and Unix sockets.
Get Started
| Build | go build |
| Usage | ./revproxy <listen-net> <listen-addr> <dial-net> <dial-addr> [bufsize] [cert] [key] |
See go docs for available listen & dial networks, and address format:
You can specify buffer size with a unit. The default is 4k.
Examples
revproxy tcp 127.0.0.1:25565 tcp example.com:25565 1krevproxy tcp [::]:443 tcp 192.168.1.100:8080 4k fullchain.pem privkey.pem
TLS
With paths to TLS cert and key files, it serves on TLS connections.
This is useful for smtp on tls, xmpp on tls, or simple https.
It automatically reloads cert files within 24 hours if they are modified.
Q&A
How about socat?
Example socat command for a similar reverse proxy:
socat tcp-listen:80,fork,reuseaddr,keepalive,keepidle=10,keepintvl=30,keepcnt=2 tcp:localhost:8080
In contrast, this program allows you to use TLS and specify a buffer size, and it uses goroutines instead of fork.
Is this ready for proxying HTTP server?
It doesnât touch HTTP headers, so there isnât X-Forwarded-For, which may affect logging. Complex servers may not work well.
Copyright
This is free and unencumbered software released into the public domain. https://unlicense.org/