Skip to content

Commit

Permalink
Add README.md and LICENSE
Browse files Browse the repository at this point in the history
  • Loading branch information
De117 committed Nov 11, 2022
1 parent 142f8a6 commit 420dc46
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright © 2016 Nathaniel J. Smith
Copyright © 2022 Antun Maldini

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”),
to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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][1] and [h11][2], 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:
```sh
python -m whitelisting_proxy --address localhost --port 8080 --config example-config.json
```

2. As a library.
The proxy (`WhitelistingProxy`) always runs in Trio's event loop, but a
wrapper (`SynchronousWhitelistingProxy`) lets you run it from normal code.

Make it your own!

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


# Performance
The proxy is single-threaded. On an Intel i7-7700HQ @ 2.80GHz, it handles ~560
connections per second. Not much, but enough for many use cases.


# License
This project is [MIT licensed][3]. `TrioHTTPConnection` from `adapter.py` is
based on [h11's example server][4], by Nathaniel J. Smith. The rest is written
by Antun Maldini.


[1]: https://github.com/python-trio/trio#readme
[2]: https://github.com/python-hyper/h11#readme
[3]: https://mit-license.org/
[4]: https://github.com/python-hyper/h11/blob/v0.14.0/examples/trio-server.py

0 comments on commit 420dc46

Please sign in to comment.