The Lupaxa SRE Toolbox
Part of The Lupaxa Project
lupaxa-port-forwarder
Listen on a local TCP port and forward each connection to a remote host and port.
Features
- Listen on a local TCP port (loopback by default)
- Forward each accepted client to a remote host and port
- One process can run several
LOCAL:HOST:REMOTEmappings - Relay bytes in both directions until either side closes
- Half-close one side without dropping the reply on the other
--bindto choose the local listen address (0.0.0.0to share on the LAN)--allowto restrict source addresses and CIDR networks--max-connectionsand--idle-timeoutto cap sessions--timeoutto bound the remote connect--verbose/--quietfor log volume- Library API (
PortForwarder,PortForwarderGroup) and CLI (port-forwarder) - Fully typed, linted, formatted, and tested
- No runtime dependencies beyond the standard library
Installation
From PyPI
pip install lupaxa-port-forwarder
From source (development mode)
pip install -e ".[dev]"
Requires Python 3.13+. No runtime dependencies.
Library quick start
from lupaxa.port_forwarder import PortForwarder
with PortForwarder(8080, "remote.example.com", 80) as forwarder:
forwarder.start()
CLI quick start
port-forwarder --help
port-forwarder 8080 remote.example.com 80
port-forwarder 8080:remote.example.com:80 5432:db.internal:5432
port-forwarder 8080 remote.example.com 80 --bind 0.0.0.0 --allow 10.0.0.0/8
port-forwarder 8080 remote.example.com 80 --max-connections 8 --idle-timeout 60
You can also run the CLI as a module:
python -m lupaxa.port_forwarder --help
python -m lupaxa.port_forwarder --version
Documentation
Online documentation:
Source repository:
Serve docs locally
From a clone of the repository:
make mkdocs-serve
Then open the local URL printed by MkDocs in your browser.
Development
Clone the repository and install with Make:
make init # first-time makefile-skills checkout
make python-install-dev # editable install with [dev]
make python-check # lint, type-check, and test
Release files for lupaxa-port-forwarder 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lupaxa_port_forwarder-0.1.1.tar.gz | 11.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lupaxa_port_forwarder-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.0 kB
Release files / lupaxa_port_forwarder-0.1.1.tar.gz
| Download URL | lupaxa_port_forwarder-0.1.1.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc8c80cf0fd354f47df55db5dcd4b5218e75bedac3e6fdb8682dd31726c8a881
|
|
BLAKE2b-256 checksum How to use checksums |
445b61b04f9ab3b26ac536f540f95ce4110356d8e77a7b93de5ca0cb57d0be6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / lupaxa_port_forwarder-0.1.1-py3-none-any.whl
| Download URL | lupaxa_port_forwarder-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
258ae32613ffae8561ca46418e4fbb41bb6605a18b0377a4f15c016d4b99cc9d
|
|
BLAKE2b-256 checksum How to use checksums |
2882ad03e65a941cdb116030f449e24d0cea5a359b9d02b6d590ec86ab87822e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log