Skip to main content

SRE Toolbox

Port Forwarder

Listen on a local TCP port and forward each connection to a remote host and port.

Install

pip install lupaxa-port-forwarder
port-forwarder --help

CLI

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
python -m lupaxa.port_forwarder --version

The tool binds a local TCP listener and relays each accepted client to the remote host and port, copying bytes in both directions until either side closes. Pass one LOCAL HOST REMOTE triple, or one or more LOCAL:HOST:REMOTE mappings. By default it binds 127.0.0.1. Use --bind 0.0.0.0 when other hosts must connect, and --allow to limit who may. --timeout bounds the remote connect. --max-connections and --idle-timeout cap concurrent sessions and quiet ones. The process stays in the foreground and stops with Ctrl+C or SIGTERM.

Library

from lupaxa.port_forwarder import PortForwarder

with PortForwarder(8080, "remote.example.com", 80) as forwarder:
    forwarder.start()

Development

make init
make python-install-dev
make python-check
make mkdocs-serve

Documentation

The published guide is at https://port-forwarder.thelupaxaproject.org/.

Site Markdown lives in mkdocs/.

The Lupaxa Project Footer

Release files for lupaxa-port-forwarder 0.1.2

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.2
File Size Uploaded
lupaxa_port_forwarder-0.1.2.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lupaxa-port-forwarder 0.1.2
File Interpreter ABI Platform
lupaxa_port_forwarder-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 22.8 kB

Release files / lupaxa_port_forwarder-0.1.2.tar.gz

Download URL lupaxa_port_forwarder-0.1.2.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ecbb8e1256921d6d78a6cce0510343088a815749ea419a8c5e8eabefbff71f34
BLAKE2b-256 checksum
How to use checksums
6cbfc31ff50fd18fb448023d92c0464ffbdfaa4f3b0c165159fbb9c108c1de72
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 25, 2026.

Transparency log

Release files / lupaxa_port_forwarder-0.1.2-py3-none-any.whl

Download URL lupaxa_port_forwarder-0.1.2-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7797f4262cbef1caee0643739a9808f5852085d3f5afc7c18ec165ee0f274bcc
BLAKE2b-256 checksum
How to use checksums
8eb20e3a8cf80ff70eee801991cf5950653bc133fd75bd00f39d3d9f9b4ebf9f
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 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

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