proxy.py/proxy/plugin/__init__.py

61 lines
2.0 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
2021-11-16 23:34:29 +00:00
.. spelling::
Cloudflare
ws
onmessage
httpbin
localhost
[v2.4.3] Support for dynamic reverse proxy routes (#1188) * Merge pull request #1162 from abhinavsingh/master v2.4.2 (#1158) * pip prod(deps): bump blacksheep from 1.2.2 to 1.2.7 (#1161) Bumps [blacksheep](https://github.com/Neoteroi/BlackSheep) from 1.2.2 to 1.2.7. - [Release notes](https://github.com/Neoteroi/BlackSheep/releases) - [Changelog](https://github.com/Neoteroi/BlackSheep/blob/main/CHANGELOG.md) - [Commits](https://github.com/Neoteroi/BlackSheep/compare/v1.2.2...v1.2.7) --- updated-dependencies: - dependency-name: blacksheep dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fregante/setup-git-user from 1.0.1 to 1.1.0 (#1160) Bumps [fregante/setup-git-user](https://github.com/fregante/setup-git-user) from 1.0.1 to 1.1.0. - [Release notes](https://github.com/fregante/setup-git-user/releases) - [Commits](https://github.com/fregante/setup-git-user/compare/v1.0.1...v1.1.0) --- updated-dependencies: - dependency-name: fregante/setup-git-user dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * npm: bump ts-node from 10.7.0 to 10.8.0 in /dashboard (#1159) Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 10.7.0 to 10.8.0. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v10.7.0...v10.8.0) --- updated-dependencies: - dependency-name: ts-node dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * npm: bump ws from 8.5.0 to 8.6.0 in /dashboard (#1165) Bumps [ws](https://github.com/websockets/ws) from 8.5.0 to 8.6.0. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/8.5.0...8.6.0) --- updated-dependencies: - dependency-name: ws dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Abhinav Singh <126065+abhinavsingh@users.noreply.github.com> * Delete FUNDING.yml * pip prod(deps): bump pytest from 6.2.5 to 7.0.1 (#1164) Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.0.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.0.1) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Abhinav Singh <126065+abhinavsingh@users.noreply.github.com> * pip prod(deps): bump rope from 0.22.0 to 1.1.1 (#1167) Bumps [rope](https://github.com/python-rope/rope) from 0.22.0 to 1.1.1. - [Release notes](https://github.com/python-rope/rope/releases) - [Changelog](https://github.com/python-rope/rope/blob/master/CHANGELOG.md) - [Commits](https://github.com/python-rope/rope/compare/0.22.0...1.1.1) --- updated-dependencies: - dependency-name: rope dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * pip prod(deps): bump starlette from 0.17.1 to 0.19.1 (#1168) Bumps [starlette](https://github.com/encode/starlette) from 0.17.1 to 0.19.1. - [Release notes](https://github.com/encode/starlette/releases) - [Changelog](https://github.com/encode/starlette/blob/master/docs/release-notes.md) - [Commits](https://github.com/encode/starlette/compare/0.17.1...0.19.1) --- updated-dependencies: - dependency-name: starlette dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * pip prod(deps): bump mypy from 0.940 to 0.960 (#1170) Bumps [mypy](https://github.com/python/mypy) from 0.940 to 0.960. - [Release notes](https://github.com/python/mypy/releases) - [Commits](https://github.com/python/mypy/compare/v0.940...v0.960) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Create FUNDING.yml * Address yaml lint * Bump actions/cache from 3.0.2 to 3.0.4 (#1185) Bumps [actions/cache](https://github.com/actions/cache) from 3.0.2 to 3.0.4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v3.0.2...v3.0.4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/setup-python from 3 to 4 (#1186) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 3 to 4. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * pip prod(deps): bump py-spy from 0.3.11 to 0.3.12 (#1174) Bumps [py-spy](https://github.com/benfred/py-spy) from 0.3.11 to 0.3.12. - [Release notes](https://github.com/benfred/py-spy/releases) - [Changelog](https://github.com/benfred/py-spy/blob/master/CHANGELOG.md) - [Commits](https://github.com/benfred/py-spy/compare/v0.3.11...v0.3.12) --- updated-dependencies: - dependency-name: py-spy dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * pip prod(deps): bump mypy from 0.960 to 0.961 (#1187) Bumps [mypy](https://github.com/python/mypy) from 0.960 to 0.961. - [Release notes](https://github.com/python/mypy/releases) - [Commits](https://github.com/python/mypy/compare/v0.960...v0.961) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add support for dynamic reverse proxy routing (#1180) * Add support for dynamic reverse proxy routing. Plugins must implement the `handle_route(self, request, pattern) -> Url` method from the base class to provide a choice of upstream url to serve. This work is backward compatible a.k.a. Old style static route patterns with hardcoded upstream urls will continue to work as-is. See `ReverseProxyBasePlugin` documentation for more details. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Address type issues * Fix spellcheck * Attempt to solve type errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Py3.8 also doesnt allow subscriptable pattern type * Remove debug print Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-11 17:26:01 +00:00
Lua
"""
from .cache import CacheResponsesPlugin, BaseCacheResponsesPlugin
from .shortlink import ShortLinkPlugin
from .proxy_pool import ProxyPoolPlugin
from .program_name import ProgramNamePlugin
from .mock_rest_api import ProposedRestApiPlugin
from .reverse_proxy import ReverseProxyPlugin
from .cloudflare_dns import CloudflareDnsResolverPlugin
from .modify_post_data import ModifyPostDataPlugin
from .web_server_route import WebServerPlugin
from .man_in_the_middle import ManInTheMiddlePlugin
from .filter_by_upstream import FilterByUpstreamHostPlugin
from .custom_dns_resolver import CustomDnsResolverPlugin
from .filter_by_client_ip import FilterByClientIpPlugin
from .filter_by_url_regex import FilterByURLRegexPlugin
from .modify_chunk_response import ModifyChunkResponsePlugin
from .modify_request_header import ModifyRequestHeaderPlugin
from .redirect_to_custom_server import RedirectToCustomServerPlugin
from .tls_intercept_conditionally import TlsInterceptConditionallyPlugin
__all__ = [
'CacheResponsesPlugin',
'BaseCacheResponsesPlugin',
'FilterByUpstreamHostPlugin',
'ManInTheMiddlePlugin',
'ProposedRestApiPlugin',
'ModifyPostDataPlugin',
'RedirectToCustomServerPlugin',
'ShortLinkPlugin',
'WebServerPlugin',
'ReverseProxyPlugin',
'ProxyPoolPlugin',
'FilterByClientIpPlugin',
'ModifyChunkResponsePlugin',
'FilterByURLRegexPlugin',
'CustomDnsResolverPlugin',
'CloudflareDnsResolverPlugin',
'ProgramNamePlugin',
'ModifyRequestHeaderPlugin',
'TlsInterceptConditionallyPlugin',
]