MagnetLink
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).
libtorrent parses a magnet link straight into an add_torrent_params; KiteTorrent has no session/add_torrent_params yet, so the parsed fields are collected into this dedicated, immutable struct. Every field maps 1:1 onto an add_torrent_params member:
infoHashV1 / infoHashV2 ←
info_hashes.v1/info_hashes.v2displayName ←
name(from thednparameter)trackers / trackerTiers ←
trackers/tracker_tiers(fromtr)webSeeds ←
url_seeds(fromws)peers ←
peers(fromx.pe); kept as the rawhost:porttext since KiteTorrent has no endpoint type in commonMaindhtNodes ←
dht_nodes(fromdht)selectOnly ← the indices the
soparameter marks for download (see below)
The on-the-wire forms of the BitTorrent URN schemes (BEP 9 / BEP 53):
xt=urn:btih:<hash>where<hash>is either the 40-character lowercase/upper hex of the 20-byte SHA-1 info-hash, or its 32-character RFC 4648 base32 encoding.xt=urn:btmh:1220<hash>(BEP 52) where1220is the multihash prefix for "sha2-256, 32 bytes" and<hash>is the 64-character hex of the v2 info-hash.
Constructors
Properties
Display name from the (URL-decoded) dn parameter, or null if absent.
v1 info-hash (SHA-1) from xt=urn:btih:, or null if the link had no v1 URN.
v2 info-hash (SHA-256) from xt=urn:btmh:1220…, or null if no v2 URN.
The set of file indices selected for download by the so (select-only) parameter, or null when no valid so parameter was present. When non-null, every file not in this set is to be skipped (libtorrent expresses this by setting default_dont_download and giving the listed indices default_priority).
Tier index assigned to each tracker, aligned with trackers. libtorrent assigns a strictly increasing tier to every accepted tr (each tracker in its own tier).