2022-01-23 11:27:58 +00:00
|
|
|
# -*- 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 typing import Any, Optional
|
|
|
|
|
|
|
|
from .client import SocksClientConnection
|
|
|
|
from ..core.base import BaseTcpServerHandler
|
|
|
|
|
|
|
|
|
|
|
|
class SocksProtocolHandler(BaseTcpServerHandler[SocksClientConnection]):
|
|
|
|
"""Reference https://www.openssh.com/txt/socks4.protocol"""
|
|
|
|
|
|
|
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
@staticmethod
|
2022-01-23 21:46:08 +00:00
|
|
|
def create(*args: Any) -> SocksClientConnection:
|
2022-01-24 06:06:51 +00:00
|
|
|
return SocksClientConnection(*args) # pragma: no cover
|
2022-01-23 11:27:58 +00:00
|
|
|
|
|
|
|
def handle_data(self, data: memoryview) -> Optional[bool]:
|
2022-01-24 06:06:51 +00:00
|
|
|
return super().handle_data(data) # pragma: no cover
|