MCPcopy Index your code
hub / github.com/abhinavsingh/proxy.py

github.com/abhinavsingh/proxy.py @v2.4.10 sqlite

repository ↗ · DeepWiki ↗ · release v2.4.10 ↗
1,416 symbols 6,095 edges 249 files 289 documented · 20%
README

Proxy.Py

PyPi Monthly Docker Pulls No Dependencies Gitter License

Tested With MacOS, Ubuntu, Windows, Android, Android Emulator, iOS, iOS Simulator Android, Android Emulator iOS, iOS Simulator

pypi version Python 3.x Checked with mypy

doc codecov lib

Contributions Welcome Need Help Sponsored by Jaxl Innovations Private Limited

Table of Contents

Features

  • A drop-in alternative to ngrok
  • Fast & Scalable

  • Scale up by using all available cores on the system

  • Threadless executions using asyncio

  • Made to handle tens-of-thousands connections / sec

    ```console

    On Macbook Pro M2 2022

    ❯ python --version Python 3.11.8 ❯ oha --version oha 1.4.3 ❯ ./benchmark/compare.sh CONCURRENCY: 100 workers, DURATION: 1m, TIMEOUT: 1sec ============================= Benchmarking Proxy.Py Server (pid:75969) running Summary: Success rate: 100.00% Total: 60.0006 secs Slowest: 0.2525 secs Fastest: 0.0002 secs Average: 0.0019 secs Requests/sec: 51667.3774

    Total data:   56.17 MiB
    Size/request: 19 B
    Size/sec:     958.64 KiB
    

    Response time histogram: 0.000 [1] | 0.025 [3073746] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.051 [10559] | 0.076 [4980] | 0.101 [2029] | 0.126 [5896] | 0.152 [2466] | 0.177 [116] | 0.202 [40] | 0.227 [52] | 0.253 [87] |

    Response time distribution: 10.00% in 0.0005 secs 25.00% in 0.0007 secs 50.00% in 0.0009 secs 75.00% in 0.0014 secs 90.00% in 0.0021 secs 95.00% in 0.0035 secs 99.00% in 0.0198 secs 99.90% in 0.1262 secs 99.99% in 0.1479 secs

    Details (average, fastest, slowest): DNS+dialup: 0.0018 secs, 0.0004 secs, 0.0031 secs DNS-lookup: 0.0000 secs, 0.0000 secs, 0.0002 secs

    Status code distribution: [200] 3099972 responses

    Error distribution: [100] aborted due to deadline ============================= ```

    Consult Threads vs Threadless and Threadless Remote vs Local Execution Mode to control number of CPU cores utilized.

    See Benchmark for more details and for how to run benchmarks locally.

  • Lightweight

  • Uses only ~5-20 MB RAM
    • No memory leaks
    • Start once and forget, no restarts required
  • Compressed containers size is only ~25 MB
  • No external dependency other than standard Python library

  • Programmable

  • Customize proxy behavior using Proxy Server Plugins. Example:
    • --plugins proxy.plugin.ProxyPoolPlugin
  • Enable builtin Web Server. Example:
    • --enable-web-server --plugins proxy.plugin.WebServerPlugin
  • Enable builtin Reverse Proxy Server. Example:
    • --enable-reverse-proxy --plugins proxy.plugin.ReverseProxyPlugin
  • Plugin API is currently in development phase. Expect breaking changes. See Deploying proxy.py in production on how to ensure reliability across code changes.

  • Can listen on multiple addresses and ports

  • Use --hostnames flag to provide additional addresses
  • Use --ports flag to provide additional ports
  • Optionally, use --port flag to override default port 8899
  • Capable of serving multiple protocols over the same port

  • Real-time Dashboard

  • Optionally, enable proxy.py dashboard.
    • Use --enable-dashboard
    • Then, visit http://localhost:8899/dashboard
  • Inspect, Monitor, Control and Configure proxy.py at runtime
  • Chrome DevTools Protocol support
  • Extend dashboard frontend using typescript based plugins
  • Dashboard is currently in development phase Expect breaking changes.

  • Secure

  • Enable end-to-end encryption between clients and proxy.py
  • See End-to-End Encryption

  • Private

  • Protection against DNS based traffic blockers
  • Browse with malware and adult content protection enabled
  • See [DNS-over-HTTPS](#cloudflarednsresolve

Extension points exported contracts — how you extend this code

IDashboardPlugin (Interface)
(no doc)
dashboard/src/core/plugin.ts
IPluginConstructor (Interface)
(no doc)
dashboard/src/core/plugin.ts

Core symbols most depended-on inside this repo

fileno
called by 124
proxy/core/listener/base.py
bytes_
called by 94
proxy/common/utils.py
text_
called by 90
proxy/common/utils.py
add_argument
called by 84
proxy/common/flag.py
format
called by 75
proxy/core/tls/hello.py
parse
called by 67
proxy/core/tls/tls.py
queue
called by 57
proxy/core/connection/connection.py
get
called by 56
benchmark/_tornado.py

Shape

Method 949
Function 231
Class 193
Route 41
Interface 2

Languages

Python84%
TypeScript16%

Modules by API surface

dashboard/static/jquery-3.4.1.min.js83 symbols
dashboard/static/popper-1.14.7.min.js52 symbols
tests/http/parser/test_http_parser.py48 symbols
proxy/http/parser/parser.py30 symbols
proxy/http/proxy/server.py26 symbols
proxy/proxy.py24 symbols
tests/common/test_flags.py23 symbols
proxy/common/utils.py23 symbols
proxy/http/server/plugin.py20 symbols
tests/http/test_url.py19 symbols
proxy/http/server/web.py19 symbols
proxy/http/handler.py19 symbols

Dependencies from manifests, versioned

@types/jasmine4.3.0 · 1×
@types/jquery3.5.14 · 1×
@types/js-cookie3.0.2 · 1×
@typescript-eslint/eslint-plugin2.34.0 · 1×
chrome-devtools-frontend1.0.1040857 · 1×
eslint6.8.0 · 1×
eslint-config-standard14.1.1 · 1×
eslint-plugin-node11.1.0 · 1×
eslint-plugin-promise4.3.1 · 1×
eslint-plugin-standard5.0.0 · 1×

For agents

$ claude mcp add proxy.py \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact