This is a small go module acting as a relay between for TCP connections that should be forwarded to a listening Onion service on the Tor network.
It optionally speaks the PROXY protocol to forward client addresses to the backing service.
An instance of the proxy is parameterized by the following options:
-l localhost:9999Where the proxy listens.
-t=falseDisable use of tor for backend socket resolution.
-r sixteencharacter.onion:80Where the proxy forwards.
-s /var/run/tor/controlWhere the tor control channel is.
-c passwordauthThe tor auth password, if using password auth.
-pinclude a PROXY header on forwarded streams.
onionproxy via the go command line:
go install github.com/willscott/onionproxy
Then add it as a daemon in your startup script, run it locally, or otherwise invoke it.
onionproxy -l 0.0.0.0:80 -r sixteencharacter.onion:80 & onionproxy -l 0.0.0.0:25 -r sixteencharacter.onion:25 -p &