proxy.core.acceptor package#
Submodules#
Module contents#
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.acceptor.Acceptor(idd: int, fd_queue: multiprocessing.connection.Connection, flags: argparse.Namespace, lock: multiprocessing.synchronize.Lock, executor_queues: List[multiprocessing.connection.Connection], executor_pids: List[int], executor_locks: List[multiprocessing.synchronize.Lock], event_queue: Optional[proxy.core.event.queue.EventQueue] = None)[source]#
Bases:
multiprocessing.context.Process
Work acceptor process.
On start-up,
Acceptor
accepts a file descriptor which will be used to accept new work. File descriptor is accepted over afd_queue
.Acceptor
goes on to listen for new work over the received server socket. By default,Acceptor
will spawn a new thread to handle each work.However, when
--threadless
option is enabled without--local-executor
,Acceptor
process will also pre-spawns aThreadless
process during start-up. Accepted work is delegated to theseThreadless
processes.Acceptor
process shares accepted work with aThreadless
process over it’s dedicated pipe.- accept(events: List[Tuple[selectors.SelectorKey, int]]) List[Tuple[socket.socket, Optional[Tuple[str, int]]]] [source]#
- class proxy.core.acceptor.AcceptorPool(flags: argparse.Namespace, listeners: proxy.core.listener.pool.ListenerPool, executor_queues: List[multiprocessing.connection.Connection], executor_pids: List[int], executor_locks: List[multiprocessing.synchronize.Lock], event_queue: Optional[EventQueue] = None)[source]#
Bases:
object
AcceptorPool is a helper class which pre-spawns
Acceptor
processes to utilize all available CPU cores for accepting new work.A file descriptor to consume work from is shared with
Acceptor
processes over a pipe. EachAcceptor
process then concurrently accepts new work over the shared file descriptor.Example usage:
- with AcceptorPool(flags=…) as pool:
- while True:
time.sleep(1)
flags.work_klass
must implementWork
class.