libtorrent4j
A swig Java interface for libtorrent.
Features | |
---|---|
Support for WebTorrent | https://webtorrent.io |
Sequential downloading | |
Torrents queueing and prioritizing | |
Torrent content selection and prioritizing | |
NAT-PMP and UPnP support | |
Fast resume support | |
HTTP proxies and basic authentication | |
IP filter | |
Torrents over SSL | |
lt_donthave extension |
BEP 54 |
Magnet URI extension - specify indices to download | BEP 53 |
BitTorrent Protocol v2 | BEP 52 |
DHT Infohash Indexing | BEP 51 |
Tracker Protocol Extension: Scrape | BEP 48 |
Padding files and attributes | BEP 47 |
Multiple-address operation for the DHT | BEP 45 |
Storing arbitrary data in the DHT | BEP 44 |
Read-only DHT Nodes | BEP 43 |
IPv6 extension for DHT | BEP 32 |
uTorrent transport protocol (uTP) | BEP 29 |
Private Torrents | BEP 27 |
Tracker Returns External IP | BEP 24 |
Tracker Returns Compact Peer Lists | BEP 23 |
Extension for Partial Seeds | BEP 21 |
HTTP/FTP Seeding (GetRight-style) | BEP 19 |
Superseeding | BEP 16 |
UDP Tracker Protocol | BEP 15 |
Local Service Discovery (LSD) | BEP 14 |
Multitracker Metadata Extension | BEP 12 |
Peer Exchange (PEX) | BEP 11 |
Extension Protocol | BEP 10 |
Magnet links | BEP 9 |
IPv6 Tracker Extension | BEP 7 |
Distributed hash table (DHT) | BEP 5 |
Using
Download the latest JAR or get the dependency via Maven:
<dependency>
<groupId>org.libtorrent4j</groupId>
<artifactId>libtorrent4j</artifactId>
<version>2.x.x</version>
</dependency>
or Gradle:
compile 'org.libtorrent4j:libtorrent4j:2.x.x'
If you use ProGuard to obfuscate/minify make sure to add the following statement
-keep class org.libtorrent4j.swig.libtorrent_jni {*;}
Note that there are multiple versions of libtorrent4j for different platforms:
libtorrent4j
libtorrent4j-android-<arch>
libtorrent4j-macos
libtorrent4j-linux
libtorrent4j-windows
These are all different artifacts, you need to select according to your architecture.
For examples look at demos and tests.
Architectures supported:
- Android (armeabi-v7a, arm64-v8a, x86, x86_64)
- macOS (x86_64)
- Linux (x86_64)
- Windows (x86_64)
About stability
This library tracks libtorrent master
branch.
The branch is very stable, runs a lot of tests, and receives bug fixes quickly.
Android local builds
It's possible to build android binaries locally. The solution is docker based, you need to have Docker installed and running (see https://docs.docker.com/engine/install/).
Go to the folder swig/android-build
and perform all the operations inside it.
1 - Build the docker image just one time (takes a long time):
docker build -t lt4j:latest .
2 - Select your architecture and run the build script, for example:
./build-arm.sh
3 - Collect the jars in build/libs
at the root of the project. Repeat
the step 2) for the desired architectures.
License
Licensed under the terms of the MIT license, available here.