socks_router.router
Attributes
Classes
Mix-in class to handle each request in a new thread. |
|
Define self.rfile and self.wfile for stream sockets. |
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Module Contents
- CHUNK_SIZE = 4096
- logger
- create_socket(type: socks_router.models.Socks5AddressType, *args: create_socket.P, **kwargs: create_socket.P) socks.socksocket [source]
- with_proxy(socket: socks.socksocket, proxy_server: socks_router.models.Address | None = None) socks.socksocket [source]
- resolve_address(address: socks_router.models.Address, logger: logging.Logger = logger, **kwargs) socks_router.models.Address [source]
- create_remote(address: socks_router.models.Address, proxy_server: socks_router.models.Address | None = None) socks.socksocket [source]
- connect_remote(destination: socks_router.models.Address, proxy_server: socks_router.models.Address | None = None, remote_socket_timeout: float | None = None, proxy_poll_socket_timeout: float = 0.1, proxy_retry_options: socks_router.models.RetryOptions | None = None, logger: logging.Logger = logger) socks.socksocket [source]
- exchange_loop(client: socket.socket, remote: socket.socket, chunk_size: int = CHUNK_SIZE, timeout: float | None = None)[source]
- match_upstream(routing_table: socks_router.models.RoutingTable, destination: socks_router.models.Address) socks_router.models.UpstreamAddress | None [source]
- class SocksRouter(*argv, context: socks_router.models.ApplicationContext | None = None, address_family: socket.AddressFamily = socket.AF_INET, **kwargs)[source]
Bases:
socketserver.ThreadingTCPServer
Mix-in class to handle each request in a new thread.
- allow_reuse_address = True
- daemon_threads = True
- block_on_close = True
- logger: logging.Logger
- address_family
- property address: socks_router.models.Address
- shutdown_request(request: socket.socket | tuple[bytes, socket.socket]) None [source]
Called to shutdown and close an individual request.
- class SocksRouterRequestHandler(request, client_address, server)[source]
Bases:
socketserver.StreamRequestHandler
Define self.rfile and self.wfile for stream sockets.
- server: SocksRouter
- property logger
- acquire_upstream(destination: socks_router.models.Address) socks_router.models.UpstreamAddress | None [source]
- reply(type: socks_router.models.Socks5ReplyType)[source]