MseByteStream

A ByteStream that transparently RC4-encrypts writes and decrypts reads for an established MSE/PE connection. This is the live counterpart of libtorrent's rc4_handler sitting in bt_peer_connection's send/recv path. RC4 is a byte-stream cipher, so the chunk boundaries a PeerConnection happens to read/write in are irrelevant; only the total byte order matters, and the per-direction locks keep encrypt-order == wire-order.

Constructors

Link copied to clipboard
constructor(raw: ByteStream, enc: MseEncryption)

Properties

Link copied to clipboard
open override val remoteAddress: String

A human-readable identifier for the remote end, for logging.

Functions

Link copied to clipboard
open suspend override fun readExactly(n: Int): ByteArray

Suspend until exactly n bytes have been read, then return them.

Link copied to clipboard
open suspend override fun write(bytes: ByteArray)

Write bytes in full (and flush, for a socket implementation).