def upstream_recv(self, data):
try:
cleartext=data.peek()
tosend=b""
i=0
packed_size=struct.pack("<I", len(cleartext))
tosend=packed_size+cleartext
tosend+=b"\x00"*(BLOCK_SIZE - (len(tosend)%BLOCK_SIZE))
data.drain(len(cleartext))
self.downstream.write(self.enc_cipher.encrypt(tosend))
except Exception as e:
logging.debug(e)
评论列表
文章目录