-
-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* `GroutClientBasePlugin` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Silence `S113` false positive * Remove example url --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c703eda
commit 0641864
Showing
4 changed files
with
68 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# -*- 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. | ||
""" | ||
|
||
|
||
from proxy.proxy import GroutClientBasePlugin | ||
from proxy.common.types import HostPort | ||
from proxy.http.parser.parser import HttpParser | ||
|
||
|
||
class GroutClientPlugin(GroutClientBasePlugin): | ||
|
||
def resolve_route( | ||
self, | ||
route: str, | ||
request: HttpParser, | ||
origin: HostPort, | ||
server: HostPort, | ||
) -> str: | ||
print(request, origin, server, '->', route) | ||
print(request.header(b'host'), request.path) | ||
# Send to localhost:7001 irrespective of the | ||
# original "route" value provided to the grout client | ||
# OR any custom host:upstream mapping provided through the | ||
# --tunnel-route flags. | ||
return 'http://localhost:7001' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters