File: socks4.py

package info (click to toggle)
python-tiny-proxy 0.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212 kB
  • sloc: python: 1,154; makefile: 3
file content (15 lines) | stat: -rw-r--r-- 474 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import logging

from .base import BaseProxyHandler
from .._proxy.abc import AbstractProxy
from .._proxy.socks4 import Socks4Proxy
from .._stream import SocketStream


class Socks4ProxyHandler(BaseProxyHandler):
    def __init__(self, username: str = None):
        self.username = username
        self.logger = logging.getLogger(__name__)

    def create_proxy(self, stream: SocketStream) -> AbstractProxy:
        return Socks4Proxy(stream=stream, username=self.username)