LoadTorrent
Thin loaders that turn raw .torrent bytes (or an already-decoded node) into a parsed torrent. This is the pure-Kotlin port of libtorrent's src/load_torrent.cpp (load_torrent_buffer / load_torrent_parsed, and the update_atp drain step).
libtorrent's loaders are deliberately thin wrappers around the torrent_info constructor; the heavy lifting (bdecoding, hashing the info dict, building the file list) lives in torrent_info, which KiteTorrent already implements as TorrentInfo. So loadTorrent is simply TorrentInfo.parse, and loadTorrentParsed / loadTorrentBuffer add the update_atp step: lifting the announce list, web seeds and DHT nodes out of the parsed torrent into an AddTorrentParams.
Scope note (faithful omission): the second half of update_atp rebuilds the v2 per-file merkle trees from the torrent's piece layers and verifies each computed root against the file's pieces root, throwing torrent_invalid_piece_layer on mismatch. That depends on torrent_info internals (piece_layer(f), _internal_drain(), free_piece_layers()) that TorrentInfo does not expose, and on the MerkleTree reconstruction machinery. It is intentionally left out of this thin core helper rather than reaching into private state; the MerkleTree / Merkle types already provide the root computation when that verification step is wired up later.
Functions
Parse a .torrent file from its raw bencoded buffer into a TorrentInfo. Equivalent to libtorrent constructing a torrent_info from a buffer, which is the core of load_torrent_buffer minus the session-level drain. Identical to TorrentInfo.parse; provided under the load_torrent name for parity with the C++ API surface.
Full load_torrent_buffer: parse buffer and drain its session-level metadata into an AddTorrentParams (see AddTorrentParams and the scope note on LoadTorrent for what is and isn't carried across).
load_torrent_parsed: build an AddTorrentParams from an already-decoded root torrent dictionary node, avoiding a re-decode when the caller already has one.