Make the underlying TCP protocol accept ipv6 addresses

This commit is contained in:
Dan 2018-06-13 13:36:26 +02:00
parent efe26bcb19
commit 56748ff390
6 changed files with 16 additions and 12 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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):

View File

@ -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)

View File

@ -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