Examples
Forward a local HTTP port
Then open 127.0.0.1:8080 in a browser or with curl.
Reach an internal database from this machine
Connect your local client to 127.0.0.1:5432.
Forward two ports in one process
Share the listener on the LAN
Other hosts in 10.0.0.0/8 can now connect to this machine's address
on port 8080. Repeat --allow for more networks.
Cap sessions and close idle ones
Bound the remote connect
Library
from lupaxa.port_forwarder import PortForwarder, PortForwarderGroup
http = PortForwarder(8080, "remote.example.com", 80, bind_host="127.0.0.1")
db = PortForwarder(5432, "db.internal", 5432, max_connections=4)
with PortForwarderGroup([http, db]) as group:
try:
group.start()
except KeyboardInterrupt:
group.stop()