This commit is contained in:
mhchia
2020-02-17 19:02:18 +08:00
parent 874c6bbca4
commit 2df47a943c
5 changed files with 63 additions and 75 deletions

View File

@ -39,9 +39,9 @@ class MsgReader(ABC):
async def read_msg(self) -> bytes:
...
@abstractmethod
async def next_msg_len(self) -> int:
...
# @abstractmethod
# async def next_msg_len(self) -> int:
# ...
class MsgWriter(ABC):
@ -52,3 +52,17 @@ class MsgWriter(ABC):
class MsgReadWriter(MsgReader, MsgWriter):
pass
class Encrypter(ABC):
@abstractmethod
def encrypt(self, data: bytes) -> bytes:
...
@abstractmethod
def decrypt(self, data: bytes) -> bytes:
...
class EncryptedMsgReadWriter(MsgReadWriter, Encrypter):
pass