Skip to main content

A small whitelisting HTTP CONNECT proxy

Project description

TunnelProxy: A small whitelisting HTTP CONNECT proxy

This is a small HTTP CONNECT proxy, with a target host whitelist.

Implemented in Python on top of trio and h11, it is written for ease of comprehension and auditing. (This makes it easy to adopt in situations where you'd want such a proxy.)

A secondary goal is to be flexible. It can be used in two ways:

  1. As a stand-alone proxy. Just run the module:

    python -m tunnelproxy --address localhost --port 8080 --config example-config.json
    
  2. As a library. The proxy (TunnelProxy) always runs in Trio's event loop, but a wrapper (SynchronousTunnelProxy) lets you run it from normal code.

    Make it your own!

For example of (2), see tunnelproxy/__main__.py.

Performance

The proxy is single-threaded.

On an AMD Ryzen 9 7900, it handles 1000 connections per second at <5ms maximal latency, as measured on a 10s burst. (See benchmarking for details.)

It's not much, but enough for many use cases.

Changelog

See docs/CHANGELOG.md.

License

This project is MIT licensed. TrioHTTPConnection from adapter.py is based on h11's example server, by Nathaniel J. Smith. The rest is written by Antun Maldini.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tunnelproxy-0.2.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tunnelproxy-0.2.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file tunnelproxy-0.2.1.tar.gz.

File metadata

  • Download URL: tunnelproxy-0.2.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for tunnelproxy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1f5de2d40098454c3f19413a827c3bf4986f6d6a0a4bb2332b51756e9fa72f21
MD5 20ff8aed83acdea5e001e18026e67f8d
BLAKE2b-256 d68fe3038277137d9c748d87ad5b3954d2079cafb3b997d20849e4f75c83da53

See more details on using hashes here.

File details

Details for the file tunnelproxy-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: tunnelproxy-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for tunnelproxy-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2851b252ed080d789a7eabf3aa4be7cbf448975d7a0c9d47f57192e2a99e1229
MD5 8eaefc4f9aa9b2a6256feb78ba945138
BLAKE2b-256 32eace623d5d65d334db4f989ecd735fe4632b4962466555a3641720c2ba025f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page