Initial implementation of MTProxy support (#1107)

This commit is contained in:
Dmitry D. Chernov
2019-02-11 09:16:46 +10:00
committed by Lonami
parent 45fdd098cc
commit 45d0ba9e2f
8 changed files with 77 additions and 24 deletions

View File

@@ -18,9 +18,10 @@ class Connection(abc.ABC):
``ConnectionError``, which will raise when attempting to send if
the client is disconnected (includes remote disconnections).
"""
def __init__(self, ip, port, *, loop, loggers, proxy=None):
def __init__(self, ip, port, dc_id, *, loop, loggers, proxy=None):
self._ip = ip
self._port = port
self._dc_id = dc_id # only for MTProxy, it's an abstraction leak
self._loop = loop
self._log = loggers[__name__]
self._proxy = proxy
@@ -94,12 +95,6 @@ class Connection(abc.ABC):
if self._writer:
self._writer.close()
def clone(self):
"""
Creates a clone of the connection.
"""
return self.__class__(self._ip, self._port, loop=self._loop)
def send(self, data):
"""
Sends a packet of data through this connection mode.