File: socks5.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 (24 lines) | stat: -rw-r--r-- 631 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import logging

from .base import BaseProxyHandler
from .._proxy.abc import AbstractProxy
from .._proxy.socks5 import Socks5Proxy
from .._stream import SocketStream


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

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