Skip to main content

Project Logo

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:REMOTE mappings
  • Relay bytes in both directions until either side closes
  • Half-close one side without dropping the reply on the other
  • --bind to choose the local listen address (0.0.0.0 to share on the LAN)
  • --allow to restrict source addresses and CIDR networks
  • --max-connections and --idle-timeout to cap sessions
  • --timeout to bound the remote connect
  • --verbose / --quiet for 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:

Documentation

Source repository:

GitHub

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
The Lupaxa Project Footer

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)

Source distribution for lupaxa-port-forwarder 0.1.1
File Size Uploaded
lupaxa_port_forwarder-0.1.1.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lupaxa-port-forwarder 0.1.1
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page