import struct import random import os from .basecodec import BaseCodec class IntermediateCodec(BaseCodec): """ Intermediate mode between `FullCodec` and `AbridgedCodec`. Always sends 4 extra bytes for the packet length. """ @staticmethod def header_length(): return 4 @staticmethod def tag(): return b'\xee\xee\xee\xee' # same as obfuscate tag def encode_packet(self, data, ip, port): return struct.pack(' 0: return packet_with_padding[:-pad_size] return packet_with_padding