proxy.core.base.tcp_tunnel module#
proxy.py#
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.
- copyright
2013-present by Abhinav Singh and contributors.
- license
BSD, see LICENSE for more details.
- class proxy.core.base.tcp_tunnel.BaseTcpTunnelHandler(*args: Any, **kwargs: Any)[source]#
Bases:
proxy.core.base.tcp_server.BaseTcpServerHandler
[proxy.core.connection.client.TcpClientConnection
]BaseTcpTunnelHandler build on-top of BaseTcpServerHandler work class.
On-top of BaseTcpServerHandler implementation, BaseTcpTunnelHandler introduces an upstream TcpServerConnection and adds it to the core event loop when needed.
Currently, implementations must call connect_upstream from within handle_data. See HttpsConnectTunnelHandler for example usage.
- _abc_impl = <_abc._abc_data object>#
- static create(*args: Any) proxy.core.connection.client.TcpClientConnection [source]#
Implementations are responsible for creation of work objects from incoming args. This helps keep work core agnostic to creation of externally defined work class objects.
- async get_events() Dict[int, int] [source]#
Return sockets and events (read or write) that we are interested in.
- abstract handle_data(data: memoryview) Optional[bool] [source]#
Optionally return True to close client connection.
- async handle_events(readables: List[int], writables: List[int]) bool [source]#
Return True to shutdown work.
- initialize() None [source]#
Optionally upgrades connection to HTTPS, sets
conn
in non-blocking mode and initializes HTTP protocol plugins.
- shutdown() None [source]#
Implementation must close any opened resources here and call super().shutdown().
- upstream: Optional[proxy.core.connection.server.TcpServerConnection]#