Skip to main content

Module tls_record

Module tls_record 

Source
Expand description

TLS record byte-stream framing used by the FakeTLS (0xEE) MTProxy transport.

Real MTProxy FakeTLS is the same Obfuscated2/PaddedIntermediate transport used by dd secrets. It is simply carried inside a decoy TLS 1.3 handshake and TLS record byte-stream framing so the traffic looks like ordinary HTTPS to DPI. These helpers only deal with that outer record framing – they know nothing about the inner Obfuscated2 cipher or PaddedIntermediate frame shape, so they’re pure and independently testable.

Structs§

RawRecord
A single raw TLS record as read during the handshake: its type byte and full wire bytes (5-byte header included).
Unwrapped
Result of scanning a byte buffer for complete TLS records.

Constants§

RECORD_APPLICATION_DATA
RECORD_CHANGE_CIPHER_SPEC
RECORD_HANDSHAKE
RECORD_HEADER_LEN
RECORD_MAX_CHUNK
TLS max plaintext record payload size (2^14), the same chunk ceiling tdesktop and other clients split at.

Functions§

change_cipher_spec_record
The one-time leading ChangeCipherSpec decoy record (0x14 0x03 0x03 0x00 0x01 0x01) real MTProxy FakeTLS servers expect before the first real Application Data record.
read_one_record
Read exactly one TLS record from stream, blocking until the 5-byte header and its declared-length payload have both arrived.
unwrap_records
Scan pending for complete TLS records during steady-state (post handshake) I/O.
wrap_application_data
Wrap already-encrypted bytes into one or more TLS Application Data records (0x17 0x03 0x03 <len(be16)> <data>), splitting at RECORD_MAX_CHUNK. Appends to out.