{"id":13682375,"url":"https://github.com/mpetazzoni/ttorrent","last_synced_at":"2025-05-14T21:07:55.947Z","repository":{"id":41233334,"uuid":"1961837","full_name":"mpetazzoni/ttorrent","owner":"mpetazzoni","description":"BitTorrent Java library with tracker and download client","archived":false,"fork":false,"pushed_at":"2024-10-09T19:21:37.000Z","size":6819,"stargazers_count":1401,"open_issues_count":72,"forks_count":504,"subscribers_count":101,"default_branch":"master","last_synced_at":"2025-04-10T14:13:52.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://mpetazzoni.github.com/ttorrent/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpetazzoni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2011-06-27T18:33:34.000Z","updated_at":"2025-04-01T08:41:03.000Z","dependencies_parsed_at":"2025-01-15T20:16:03.420Z","dependency_job_id":"c5992a33-5569-4167-b142-5bc1898e035e","html_url":"https://github.com/mpetazzoni/ttorrent","commit_stats":{"total_commits":905,"total_committers":21,"mean_commits":"43.095238095238095","dds":0.3104972375690608,"last_synced_commit":"bbe2ea1f3844c884654fc7f70b641e983c9dfe10"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetazzoni%2Fttorrent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetazzoni%2Fttorrent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetazzoni%2Fttorrent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetazzoni%2Fttorrent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpetazzoni","download_url":"https://codeload.github.com/mpetazzoni/ttorrent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227613,"owners_count":22035670,"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","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":[],"created_at":"2024-08-02T13:01:45.060Z","updated_at":"2025-05-14T21:07:50.915Z","avatar_url":"https://github.com/mpetazzoni.png","language":"Java","funding_links":[],"categories":["Java","VI. Program languages and applications that were written with Java","网络编程"],"sub_categories":["5. Opensource applications that were written with Java","Spring Cloud框架"],"readme":"[![JetBrains team project](http://jb.gg/badges/team.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)\n\nTtorrent, a Java implementation of the BitTorrent protocol\n==========================================================\n\n#### Note\nIt's Ttorrent library version 2.0 which has\na lot of improvements and may not be compatible with previous version\n(stored in [v1.6 branch](https://github.com/mpetazzoni/ttorrent/tree/v1.6))\n\nSee [this issue](https://github.com/mpetazzoni/ttorrent/issues/212) for details \n\nDescription\n-----------\n\n**Ttorrent** is a pure-Java implementation of the BitTorrent protocol,\nproviding a BitTorrent tracker, a BitTorrent client and the related Torrent\nmetainfo files creation and parsing capabilities. It is designed to be embedded\ninto larger applications, but its components can also be used as standalone\nprograms.\n\nTtorrent supports the following BEPs (BitTorrent enhancement proposals):\n\n* `BEP#0003`: The BitTorrent protocol specification  \n  This is the base official protocol specification, which Ttorrent implements\n  fully.\n* `BEP#0012`: Multi-tracker metadata extension  \n  Full support for the `announce-list` meta-info key providing a tiered tracker\n  list.\n* `BEP#0015`: UDP Tracker Protocol for BitTorrent  \n  The UDP tracker protocol is fully supported in the BitTorrent client to make\n  announce requests to UDP trackers. UDP tracker support itself is planned.\n* `BEP#0020`: Peer ID conventions  \n  Ttorrent uses `TO` as the client identification string, and currently uses\n  the `-T00042-` client ID prefix.\n* `BEP#0023`: Tracker Returns Compact Peer Lists  \n  Compact peer lists are supported in both the client and the tracker.\n  Currently the tracker only supports sending back compact peer lists\n  to an announce request.\n\nHistory\n-------\n\nThis tool suite was implemented as part of Turn's (http://www.turn.com) release\ndistribution and deployment system and is used to distribute new build tarballs\nto a large number of machines inside a datacenter as efficiently as possible.\nAt the time this project was started, few Java implementations of the\nBitTorrent protocol existed and unfortunately none of them fit our needs:\n\n* Vuze's, which is very hard to extract from their codebase, and thus complex\nto re-integrate into another application;\n* torrent4j, which is largely incomplete and not usable;\n* Snark's, which is old, and unfortunately unstable;\n* bitext, which was also unfortunately unstable, and extremely slow.\n\nThis implementation aims at providing a down-to-earth, simple to use library.\nNo fancy protocol extensions are implemented here: just the basics that allows\nfor the exchange and distribution of files through the BitTorrent protocol.\n\nHow to use\n----------\n\n### As a library\n\n#### Client code\n\n```java\n// First, instantiate the Client object.\nSimpleClient client = new SimpleClient();\n\n// This is the interface the client will listen on (you might need something\n// else than localhost here because other peers cannot connect to localhost).\nInetAddress address = InetAddress.getLocalHost();\n\n//Start download. Thread is blocked here\ntry {\n  client.downloadTorrent(\"/path/to/filed.torrent\",\n          \"/path/to/output/directory\",\n          address);\n  //download finished\n} catch (Exception e) {\n  //download failed, see exception for details\n  e.printStackTrace();\n}\n//If you don't want to seed the torrent you can stop client\nclient.stop();\n```\n\n#### Tracker code\n\n```java\n// First, instantiate a Tracker object with the port you want it to listen on.\n// The default tracker port recommended by the BitTorrent protocol is 6969.\nTracker tracker = new Tracker(6969);\n\n// Then, for each torrent you wish to announce on this tracker, simply created\n// a TrackedTorrent object and pass it to the tracker.announce() method:\nFilenameFilter filter = new FilenameFilter() {\n  @Override\n  public boolean accept(File dir, String name) {\n    return name.endsWith(\".torrent\");\n  }\n};\n\nfor (File f : new File(\"/path/to/torrent/files\").listFiles(filter)) {\n  tracker.announce(TrackedTorrent.load(f));\n}\n\n//Also you can enable accepting foreign torrents.\n//if tracker accepts request for unknown torrent it starts tracking the torrent automatically\ntracker.setAcceptForeignTorrents(true);\n\n// Once done, you just have to start the tracker's main operation loop:\ntracker.start(true);\n\n// You can stop the tracker when you're done with:\ntracker.stop();\n```\n\nLicense\n-------\n\nThis BitTorrent library is distributed under the terms of the Apache Software\nLicense version 2.0. See COPYING file for more details.\n\n\nAuthors and contributors\n------------------------\n\n* Maxime Petazzoni \u003c\u003cmpetazzoni@turn.com\u003e\u003e (Platform Engineer at Turn, Inc)  \n  Original author, main developer and maintainer\n* David Giffin \u003c\u003cdavid@etsy.com\u003e\u003e  \n  Contributed parallel hashing and multi-file torrent support.\n* Thomas Zink \u003c\u003cthomas.zink@uni-konstanz.de\u003e\u003e  \n  Fixed a piece length computation issue when the total torrent size is an\n  exact multiple of the piece size.\n* Johan Parent \u003c\u003cparent_johan@yahoo.com\u003e\u003e  \n  Fixed a bug in unfresh peer collection and issues on download completion on\n  Windows platforms.\n* Dmitriy Dumanskiy  \n  Contributed the switch from Ant to Maven.\n* Alexey Ptashniy  \n  Fixed an integer overflow in the calculation of a torrent's full size.\n\n\nCaveats\n-------\n\n* Client write performance is a bit poor, mainly due to a (too?) simple piece\n  caching algorithm.\n\nContributions are welcome in all areas, even more so for these few points\nabove!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpetazzoni%2Fttorrent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpetazzoni%2Fttorrent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpetazzoni%2Fttorrent/lists"}