⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.
2013-present by Abhinav Singh and contributors.
BSD, see LICENSE for more details.
- class proxy.core.work.threadless.Threadless(iid: str, work_queue: proxy.core.work.threadless.T, flags: argparse.Namespace, event_queue: Optional[EventQueue] = None)#
Work executor base class.
Threadless provides an event loop, which is shared across multiple
Workinstances to handle work.
Threadless takes input a
work_klassmust conform to the
Workprotocol. Work is received over the
When a work is accepted, threadless creates a new instance of
work_klass. Threadless will then invoke necessary lifecycle of the
work_klassimplementation to handle the assigned work.
Workprotocol. It expects a client connection as work payload and hooks into the threadless event loop to handle the client connection.
- _abc_impl = <_abc._abc_data object>#
- async _selected_events() Tuple[Dict[int, Tuple[List[int], List[int]]], bool] #
For each work, collects events that they are interested in. Calls select for events of interest.
Returns a 2-tuple containing a dictionary and boolean. Dictionary keys are work IDs and values are 2-tuple containing ready readables & writables.
Returned boolean value indicates whether there is a newly accepted work waiting to be received and queued for processing. This is only applicable when
work_queue_filenoreturns a valid fd.
- _upstream_conn_pool: Optional['UpstreamConnectionPool']#
- close_work_queue() None #
Only called if
work_queue_filenoreturns an integer. If an fd is select-able for work queue, make sure to close the work queue fd now.
- abstract property loop: Optional[asyncio.events.AbstractEventLoop]#
- abstract receive_from_work_queue() bool #
Work queue is ready to receive new work.
Receive it and call
Return True to tear down the loop.
- unfinished: Set['asyncio.Task[bool]']#
- abstract work_queue_fileno() Optional[int] #
If work queue must be selected before calling
receive_from_work_queuethen implementation must return work queue fd.