dotnet BitTorrent library written in C#
by darren horrocksSystem.Net.Torrent is an open source bittorrent scraper and peer wire implementation written in C#
It includes:
- Tracker Announce (HTTP/UDP)
- Tracker Scrape (HTTP/UDP)
- PeerWire (TCP) Client
- Choke
- Unchoke
- Interested
- Not Interested
- Have
- Bitfield (Optional obsfucation)
- Request
- Piece
- Fast Protocol Extensions
- Extended Protocol Extensions
- Local Peer Discovery (Non-existant Multicast BEP-14)
- Peer Exchange (utPEX)
- Trackerless Metadata (utMetadata)
- Magnet Link Parser
- Bencode Encode/Decode
- .torrent Metadata Parser
- Tracker Exchange Protocol
Resolving a magnet link to metadata (.torrent file)
static void TestAsyncMagnetLink()
{
var ubuntuMagnetLink = "magnet:?xt=urn:btih:e4be9e4db876e3e3179778b03e906297be5c8dbe&dn=ubuntu-18.04-desktop-amd64.iso&tr=http://torrent.ubuntu.com:6969/announce";
var magnetMetadata = MagnetLink.ResolveToMetadata(ubuntuMagnetLink);
foreach (var item in magnetMetadata.AnnounceList)
{
Console.WriteLine(item);
}
}
Scraping announce/tracker URLs
static void ScrapeTorrent()
{
var scraper = new HTTPTrackerClient(15);
var announce = scraper.Scrape("http://torrent.ubuntu.com:6969/announce", new string[] { "e4be9e4db876e3e3179778b03e906297be5c8dbe" });
}
Announce (request peers from the tracker)
static void AnnounceTorrent()
{
var scraper = new HTTPTrackerClient(15);
var peers = scraper.Announce("http://torrent.ubuntu.com:6969/announce", "e4be9e4db876e3e3179778b03e906297be5c8dbe", "-LW2222-011345223110");
}