Listen on a tcp4 address passed by systemd and forward connections to a specified tcp6 address. Except for the systemd
socket path this could be done with tools like socat but I want to have something that can do exactly that and
nothing more.
This project is released under GNU Affero General Public License v3.0, see LICENCE file in this repo for more info.
Package tcpto6 provides an program that takes a net.Listener from systemd and accepts connections from it.
For each accepted connection it dials to a predefined tcp6 address and bridges the connection if the dial succeeds.
ToAddrEnvName is the name of the environment variable that contains the address that should be dialed for accepted
connections. Must be in a format that net.Dial understands.
Run fetches the listening socket from systemd, the target address from the env var and calls handleListener
with them. It closes the listener when the given context ctx is canceled.
The source code repository contains the directory /init with an example .service and .socket file.