buildUtpPacket
fun buildUtpPacket(header: UtpHeader, payload: ByteArray = EMPTY_BYTES, sack: ByteArray? = null): ByteArray
Build a full uTP packet: header (its UtpHeader.extension is overridden to advertise a SACK iff sack is non-null), then, if present, the SACK extension TLV (next_ext=0, len, bitmask), then payload.
The extension framing matches the chain libtorrent writes/reads: each extension is { next_extension_id : u8, length : u8, body[length] } (see the while (extension) loop in incoming_packet() and remove_sack_header()). This core only ever emits a single SACK extension followed by next_ext = 0.