mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
Refactor
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user