initiate

suspend fun initiate(raw: ByteStream, infoHash: Sha1Hash, rng: Random = Random.Default, allowedEncLevel: Int = ALLOW_BOTH): ByteStream

Active open (we dialed): run the MSE handshake as the initiator, offering the crypto methods permitted by allowedEncLevel. Returns the negotiated transport (MseByteStream for RC4, raw for plaintext). Throws MseException on any verification failure.

Parameters

allowedEncLevel

one of ALLOW_PLAINTEXT / ALLOW_RC4 / ALLOW_BOTH (== settings_pack::allowed_enc_level); defaults to ALLOW_BOTH so existing call sites keep offering both methods. Any value not intersecting ALLOW_BOTH falls back to offering both, mirroring bt_peer_connection::write_pe1_2_dhkey.