mirror of
https://github.com/pyrogram/pyrogram
synced 2025-09-01 14:55:12 +00:00
Make the underlying TCP protocol accept ipv6 addresses
This commit is contained in:
@@ -33,8 +33,9 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class TCP(socks.socksocket):
|
class TCP(socks.socksocket):
|
||||||
def __init__(self, proxy: dict):
|
def __init__(self, ipv6: bool, proxy: dict):
|
||||||
super().__init__()
|
super().__init__(family=socket.AF_INET6 if ipv6 else socket.AF_INET)
|
||||||
|
|
||||||
self.settimeout(10)
|
self.settimeout(10)
|
||||||
self.proxy_enabled = proxy.get("enabled", False)
|
self.proxy_enabled = proxy.get("enabled", False)
|
||||||
|
|
||||||
|
@@ -24,8 +24,8 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class TCPAbridged(TCP):
|
class TCPAbridged(TCP):
|
||||||
def __init__(self, proxy: dict):
|
def __init__(self, ipv6: bool, proxy: dict):
|
||||||
super().__init__(proxy)
|
super().__init__(ipv6, proxy)
|
||||||
|
|
||||||
def connect(self, address: tuple):
|
def connect(self, address: tuple):
|
||||||
super().connect(address)
|
super().connect(address)
|
||||||
|
@@ -28,8 +28,9 @@ log = logging.getLogger(__name__)
|
|||||||
class TCPAbridgedO(TCP):
|
class TCPAbridgedO(TCP):
|
||||||
RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4)
|
RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4)
|
||||||
|
|
||||||
def __init__(self, proxy: dict):
|
def __init__(self, ipv6: bool, proxy: dict):
|
||||||
super().__init__(proxy)
|
super().__init__(ipv6, proxy)
|
||||||
|
|
||||||
self.encrypt = None
|
self.encrypt = None
|
||||||
self.decrypt = None
|
self.decrypt = None
|
||||||
|
|
||||||
|
@@ -26,8 +26,9 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class TCPFull(TCP):
|
class TCPFull(TCP):
|
||||||
def __init__(self, proxy: dict):
|
def __init__(self, ipv6: bool, proxy: dict):
|
||||||
super().__init__(proxy)
|
super().__init__(ipv6, proxy)
|
||||||
|
|
||||||
self.seq_no = None
|
self.seq_no = None
|
||||||
|
|
||||||
def connect(self, address: tuple):
|
def connect(self, address: tuple):
|
||||||
|
@@ -25,8 +25,8 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class TCPIntermediate(TCP):
|
class TCPIntermediate(TCP):
|
||||||
def __init__(self, proxy: dict):
|
def __init__(self, ipv6: bool, proxy: dict):
|
||||||
super().__init__(proxy)
|
super().__init__(ipv6, proxy)
|
||||||
|
|
||||||
def connect(self, address: tuple):
|
def connect(self, address: tuple):
|
||||||
super().connect(address)
|
super().connect(address)
|
||||||
|
@@ -29,8 +29,9 @@ log = logging.getLogger(__name__)
|
|||||||
class TCPIntermediateO(TCP):
|
class TCPIntermediateO(TCP):
|
||||||
RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4)
|
RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4)
|
||||||
|
|
||||||
def __init__(self, proxy: dict):
|
def __init__(self, ipv6: bool, proxy: dict):
|
||||||
super().__init__(proxy)
|
super().__init__(ipv6, proxy)
|
||||||
|
|
||||||
self.encrypt = None
|
self.encrypt = None
|
||||||
self.decrypt = None
|
self.decrypt = None
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user