makeMagnetUri

Format a magnet: URI for info: a port of make_magnet_uri(torrent_info const&) (which forwards to make_magnet_uri(add_torrent_params const&)) in src/magnet_uri.cpp.

Emits the v1 and/or v2 info-hash URN(s), then the display name (dn), the flat list of tracker URLs (tr, across all tiers, in order) and the web seeds (ws). Values are percent-encoded with UrlEscape.escape, exactly like libtorrent's escape_string. Returns "" when info has no info-hash at all (so no link can be formed), matching the C++ early-out.


fun makeMagnetUri(infoHashV1: Sha1Hash? = null, infoHashV2: Sha256Hash? = null, displayName: String? = null, trackers: List<String> = emptyList(), webSeeds: List<String> = emptyList(), dhtNodes: List<Pair<String, Int>> = emptyList(), peers: List<String> = emptyList()): String

Format a magnet: URI from explicit pieces: the analogue of make_magnet_uri(add_torrent_params const&) for callers that do not have a TorrentInfo. At least one of infoHashV1 / infoHashV2 must be non-null or "" is returned. dhtNodes are emitted as dht=host:port and peers verbatim as x.pe=… (already in host:port text form), matching the C++.