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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lupaxa_port_forwarder-0.1.0.tar.gz.
File metadata
- Download URL: lupaxa_port_forwarder-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d73aab70e3c3ba67a0297f6fc30332e92e26979ca31cdbd0d73a58f8a392881
|
|
| MD5 |
13dbba6a9519b9aede874d53579284f6
|
|
| BLAKE2b-256 |
478758c2e1b2eef3a6aee4b2a8e22ed14dc78aa1ca06c6ac87238600144758a7
|
Provenance
The following attestation bundles were made for lupaxa_port_forwarder-0.1.0.tar.gz:
Publisher:
generate-release.yml on lupaxa-sre-toolbox/port-forwarder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lupaxa_port_forwarder-0.1.0.tar.gz -
Subject digest:
9d73aab70e3c3ba67a0297f6fc30332e92e26979ca31cdbd0d73a58f8a392881 - Sigstore transparency entry: 2781046762
- Sigstore integration time:
-
Permalink:
lupaxa-sre-toolbox/port-forwarder@db12997cd03b6d884f0caeb20612235c365484d6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/lupaxa-sre-toolbox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
generate-release.yml@db12997cd03b6d884f0caeb20612235c365484d6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lupaxa_port_forwarder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lupaxa_port_forwarder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a7a85697631d0756576a262ca6bfcdfc52e0aa37e435f8e26d9035c935ce487
|
|
| MD5 |
94821cb2a0fd7bb798398d6b40ac0063
|
|
| BLAKE2b-256 |
950d1bfeebf281d29611ad632345cec95cc0663abe987601048716ac8aff768b
|
Provenance
The following attestation bundles were made for lupaxa_port_forwarder-0.1.0-py3-none-any.whl:
Publisher:
generate-release.yml on lupaxa-sre-toolbox/port-forwarder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lupaxa_port_forwarder-0.1.0-py3-none-any.whl -
Subject digest:
5a7a85697631d0756576a262ca6bfcdfc52e0aa37e435f8e26d9035c935ce487 - Sigstore transparency entry: 2781047554
- Sigstore integration time:
-
Permalink:
lupaxa-sre-toolbox/port-forwarder@db12997cd03b6d884f0caeb20612235c365484d6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/lupaxa-sre-toolbox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
generate-release.yml@db12997cd03b6d884f0caeb20612235c365484d6 -
Trigger Event:
push
-
Statement type: