Package-level declarations

Types

Link copied to clipboard

The add-a-torrent payload produced by LoadTorrent. This is the pure-Kotlin analogue of the fields libtorrent's load_torrent_* functions populate in an add_torrent_params (src/load_torrent.cpp, update_atp).

Link copied to clipboard
class CreateTorrent(storage: FileStorage, v1Only: Boolean = false, v2Only: Boolean = false)

Builds a .torrent file from a set of files, piece geometry and pre-computed piece hashes -- pure-Kotlin port of libtorrent's create_torrent (src/create_torrent.cpp, include/libtorrent/create_torrent.hpp).

Link copied to clipboard
class FileEntry(val path: String, val size: Long, val offset: Long, val piecesRoot: Sha256Hash? = null, val isPadFile: Boolean = false, val symlinkTarget: String? = null, val isExecutable: Boolean = false, val isHidden: Boolean = false)

One file within a torrent: port of the per-file data libtorrent keeps in file_storage (file_storage.hpp). offset is the file's start within the torrent's single concatenated byte stream, which is what maps pieces to files.

Link copied to clipboard

The set of files in a torrent and the geometry that ties them to pieces: port of libtorrent's file_storage. For a single-file torrent there is exactly one entry whose path is the torrent name.

Link copied to clipboard
class HashPicker(info: TorrentInfo, trees: Map<Int, MerkleTree>)

Decides which BitTorrent v2 merkle-hash ranges to request from peers, and validates the hashes responses into per-file MerkleTrees. This is a practical-level port of libtorrent's hash_picker (src/hash_picker.cpp).

Link copied to clipboard

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).

Link copied to clipboard
class MagnetLink(val infoHashV1: Sha1Hash?, val infoHashV2: Sha256Hash?, val displayName: String?, val trackers: List<String>, val trackerTiers: List<Int>, val webSeeds: List<String>, val peers: List<String>, val dhtNodes: List<Pair<String, Int>>, val selectOnly: Set<Int>?)

The information extracted from a magnet: URI: the pure-Kotlin counterpart of the subset of libtorrent's add_torrent_params that parseMagnetUri fills in (src/magnet_uri.cpp, parse_magnet_uri).

Link copied to clipboard
object MagnetUri

Parsing and formatting of magnet: URIs: a pure-Kotlin port of parse_magnet_uri and make_magnet_uri from libtorrent's src/magnet_uri.cpp.

Link copied to clipboard
object Merkle

Pure-Kotlin port of libtorrent's merkle-tree free functions (include/libtorrent/aux_/merkle.hpp + src/merkle.cpp).

Link copied to clipboard
class MerkleTree(val numBlocks: Int, blocksPerPiece: Int = 1, expectedRoot: Sha256Hash? = null)

In-memory BitTorrent v2 merkle tree for one file: a focused pure-computation port of libtorrent's aux::merkle_tree (include/libtorrent/aux_/merkle_tree.hpp

Link copied to clipboard

A parsed .torrent file. This is the pure-Kotlin counterpart of libtorrent's torrent_info (torrent_info.cpp). Built from the bencoded bytes of a torrent, it exposes the metadata a client needs: the name, the file list, piece geometry, the trackers, and the info-hash or hashes.