{"id":16712675,"url":"https://github.com/surgeonix/bitswarm","last_synced_at":"2025-10-06T03:15:43.556Z","repository":{"id":43598169,"uuid":"261001787","full_name":"SuRGeoNix/BitSwarm","owner":"SuRGeoNix","description":"Bittorrent library for clients \u0026 streaming purposes","archived":false,"fork":false,"pushed_at":"2024-05-10T06:11:05.000Z","size":2628,"stargazers_count":119,"open_issues_count":0,"forks_count":10,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-07-23T00:43:56.566Z","etag":null,"topics":["bittorent","bittorrent-client","bittorrent-dht-protocol","bittorrent-protocol","dht","streaming","torrent","torrent-client","torrent-downloader","torrent-streamer","torrent-streaming","torrent-tracker"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SuRGeoNix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-03T19:09:26.000Z","updated_at":"2025-06-11T20:47:09.000Z","dependencies_parsed_at":"2024-10-26T21:10:44.182Z","dependency_job_id":"df716cae-89b4-4dfe-93e6-e438f0698aa9","html_url":"https://github.com/SuRGeoNix/BitSwarm","commit_stats":{"total_commits":67,"total_committers":3,"mean_commits":"22.333333333333332","dds":"0.31343283582089554","last_synced_commit":"76aeb3f6e5c74f63f1f89017e4c77622ee933e4b"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/SuRGeoNix/BitSwarm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuRGeoNix%2FBitSwarm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuRGeoNix%2FBitSwarm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuRGeoNix%2FBitSwarm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuRGeoNix%2FBitSwarm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SuRGeoNix","download_url":"https://codeload.github.com/SuRGeoNix/BitSwarm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuRGeoNix%2FBitSwarm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271330292,"owners_count":24740815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bittorent","bittorrent-client","bittorrent-dht-protocol","bittorrent-protocol","dht","streaming","torrent","torrent-client","torrent-downloader","torrent-streamer","torrent-streaming","torrent-tracker"],"created_at":"2024-10-12T20:31:21.232Z","updated_at":"2025-10-06T03:15:38.513Z","avatar_url":"https://github.com/SuRGeoNix.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BitSwarm: Bittorrent library (.net standard) for clients \u0026 streaming purposes\n\n## [Introduction]\nBitSwarm implements __Bittorrent Protocol v2__ from scratch to achieve best performance and to expose low-level parameters for customization. It uses a custom thread pool and part files (\u003ca href=\"https://github.com/SuRGeoNix/APF\"\u003eAPF\u003c/a\u003e) for fast resume from previous incomplete session.\n\n## [Supports]\n* Inputs (torrent file, magnet link, SHA1/Base32 hash)\n* Automatic Save \u0026 Load from a previous incomplete session\n* XML Import/Export Options for Timing/Feeding \u0026 Logging Configuration\n* Feeders (DHT, PEX, Trackers \u0026 External Trackers File)\n* Peers Communication (autonomous life-cycle with minimal dropped bytes)\n* Piece SHA1 validation \u0026 phony packets / broken clients protection\n* Start/End Game modes (fast metadata retrieval, initial boosting \u0026 closure)\n* Sleep mode for minimal resources usage (disables feeders \u0026 uses half threads based on specify download rate)\n* Focus Areas to bypass normal pieces selection (for streaming)\n* Dynamic change of options (eg) for streaming - useful for changing timeouts/retries during seeking/buffering for fast resets on requested pieces)\n\n## [Todo]\n* uTP\n* IPv6 DHT/Trackers\n* Download / Upload Rate Limits\n* Uploading / Seeding\n* VPN / Proxy / Encryption\n* NAT Traversal / PnP / Hole-punching\n\n## [Examples]\n\n### 1. Library Overview\n``` c#\n// Step 0: Prepare BitSwarm's Options (Timeouts/Feeders/Logging etc.)\n\nOptions opt = new Options();\n\t//opt.X = Y; check Options.cs for all available options\n\n// Step 1: Create BitSwarm Instance\n\n\t// With Default Options\nBitSwarm bitSwarm = new BitSwarm();\n\t// With Custom Options\nBitSwarm bitSwarm = new BitSwarm(opt);\n\n// Step 2: Subscribe events\n\n\t// Receives torrent data (on torrent file/session will fire directly, on magnetlink/hash will fire on metadata received - notify user with torrent detail and optionally choose which files to include)\nbitSwarm.MetadataReceived   += BitSwarm_MetadataReceived; \t// e.Torrent\n\t// Receives statistics (refresh every 2 seconds - notify user with the current connections/bytes/speed of downloading)\nbitSwarm.StatsUpdated       += BitSwarm_StatsUpdated;\t\t// e.Stats\n\t// Notifies with the new status (notify user with 0: Finished, 1: Stopped, 2: Error)\nbitSwarm.StatusChanged      += BitSwarm_StatusChanged;\t\t// e.Status\n\t// Notifies that is going to stop (user can prevent it from finishing, by including other previously excluded files)\nbitSwarm.OnFinishing        += BitSwarm_OnFinishing;\t\t// e.Cancel\n\n// Step 3: Open input (Current BitSwarm's valid inputs Torrent File/Magnet Link/SHA1 Hash/Base32 Hash/Session File)\n\n\t// Open Torrent File\nbitSwarm.Open(\"/home/surgeonix/ubuntu.torrent\");\n\t// Open Magnet Link\nbitSwarm.Open(\"magnet:?xt=urn:btih:D1101A2B9D202811A05E8C57C557A20BF974DC8A\");\n\t// Open SHA1 Hash\nbitSwarm.Open(\"D1101A2B9D202811A05E8C57C557A20BF974DC8A\");\n\t// Open Base32 (SHA1) Hash\nbitSwarm.Open(\"RX46NCATYQRS3MCQNSEXVZGCCDNKTASQ\");\n\n// Step 4: Start downloading\nbitSwarm.Start();\n\n// Step 5: Dispose when you are done\nbitSwarm.Dispose();\n```\n\n### 2. \u003ca href=\"https://github.com/SuRGeoNix/BitSwarm/blob/master/BitSwarm%20(Console%20Core%20Demo)/Program.cs\"\u003eBitSwarm\u003c/a\u003e: Console Client (.NET Core)\n\u003cp align=\"center\"\u003e\u003cimg src=\"Images/bitswarm.gif\"/\u003e\u003c/p\u003e\n\n### 3. \u003ca href=\"https://github.com/SuRGeoNix/BitSwarm/blob/master/BitSwarm%20(WinForms%20Demo)/frmMain.cs\"\u003eBitSwarm\u003c/a\u003e: GUI Client (.NET Framework Winforms)\n\u003cp align=\"center\"\u003e\u003cimg src=\"Images/bitswarm_gui.png\"/\u003e\u003c/p\u003e\n\n### 4. \u003ca href=\"https://github.com/SuRGeoNix/Flyleaf\"\u003eFlyleaf\u003c/a\u003e: Video Player \u0026 Torrent Streamer (.NET Framework Winforms)\n\u003cp align=\"center\"\u003e\u003cimg src=\"Images/flyleaf.png\"/\u003e\u003c/p\u003e\n\n## Remarks\n\nThis project has been created for fun and educational reasons. Hopefully, it will help other developers to understand deeper the bittorrent protocol as the documentations and standards are very complicated and messy. I tried to add detailed comments within the code. Don't use it as is, it does not currently implement upload and sharing, which means that it is an arrogant and selfish beggar!\n\n| Logs Sample | Stats Sample 1 |\n| :-------------:       |:-------------:            |\n| \u003ca href=\"Images/logs1.png\"\u003e\u003cimg src=\"Images/logs1.png\" width=\"50%\" heigt=\"50%\"/\u003e\u003c/a\u003e | \u003ca href=\"Images/stats1.png\"\u003e\u003cimg src=\"Images/stats1.png\" width=\"50%\" heigt=\"50%\"/\u003e\u003c/a\u003e |\n\n| Stats Sample 2 | Stats Sample 3 |\n| :-------------:       |:-------------:            |\n| \u003ca href=\"Images/stats2.png\"\u003e\u003cimg src=\"Images/stats2.png\" width=\"50%\" heigt=\"50%\"/\u003e\u003c/a\u003e | \u003ca href=\"Images/stats3.png\"\u003e\u003cimg src=\"Images/stats3.png\" width=\"50%\" heigt=\"50%\"/\u003e\u003c/a\u003e |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurgeonix%2Fbitswarm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurgeonix%2Fbitswarm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurgeonix%2Fbitswarm/lists"}