addMagnet

suspend fun addMagnet(magnet: MagnetLink, peers: List<PeerEndpoint>, diskFactory: (TorrentInfo) -> DiskIo): TorrentSession?

Start a download from a magnet link. Connects to peers (from the magnet's trackers or the DHT, since discovery is the caller's or the engine's job), fetches the metadata from the first cooperative peer via BEP-9 ut_metadata, builds a TorrentInfo, then begins a normal download with the disk diskFactory produces. Returns null if no peer could supply the metadata.


suspend fun addMagnet(magnet: MagnetLink, diskFactory: (TorrentInfo) -> DiskIo): TorrentSession?

Convenience magnet add with built-in peer discovery. Pools peers for the magnet's info-hash from the DHT (when enableDht) and from the magnet's trackers, then delegates to the peer-list addMagnet overload, which fetches the metadata via BEP-9 ut_metadata and starts the download. Returns null if no peer was reachable or none could supply the metadata.