Bt is a modern Java 8 BitTorrent library. It offers good performance, reliability and is highly customizable.
© 2016-2021
Andrei Tomashpolskiy
Release 1.3 was published to Maven Central on July 29th, 2017. It includes two major updates:
Officially called BEP-9: Extension for Peers to Send Metadata Files, this feature is highly important for any modern BitTorrent client. It allows the participants of a BitTorrent network to exchange torrent metadata without the need for downloading a .torrent
file.
New methods in the client builder make using a magnet link in Bt very straight-forward:
// create a streaming torrent from a magnet link
BtClient client = Bt.client()
.storage(new FileSystemStorage(new File("~/Downloads")))
.selector(SequentialSelector.sequential())
.magnet("magnet:?xt=urn:btih:B5A725522B0B4DB73AD2491BA1AD58F13D853315")
.build();
Some magnet links also contain “bootstrapping” tracker and peer addresses, which can be used to quickly connect to the swarm. Of course, these are fully supported as well. For convenience, there’s also an overloaded version of builder method: bt.BaseClientBuilder#magnet(bt.magnet.MagnetUri)
, that accepts a programmatically created magnet link.
CLI launcher has also been updated to accommodate this new feature. E.g. streaming a media file is now as easy as copying the magnet link from browser and providing it to the launcher via -m
parameter and adding an -S
flag to download in sequential order:
$ java -jar bt-launcher.jar -m "magnet:?xt=urn:btih:B5A725522B0B4DB73AD2491BA1AD58F13D853315" -d ~/Downloads -S
Bt has had DHT support for nearly half a year already, but only now it’s become possible to publish the bt-dht
module to Maven Central, removing the need to build it manually from source. It’s all thanks to the authors and maintainers of Bittorrent Mainline DHT implementation in Java, who have agreed to change the license from GPL 2.0 to a more permissive Mozilla License 2.0, which is compatible with Apache License 2.0, used by Bt. My personal thanks to The8472, who currently maintains mldht and have coordinated this change.
As usual, here’s the complete list of what has been done: