A simple BitTorrent client in Go.
This client is pretty small & simple, however it has been structured to use minimal dependencies and follows a standard pattern to make the code easier to read.
There are a couple of things needed to get started.
Instructions on installing Go 1.18 can be found in the link provided.
Pretty much that's it :)
Now, download dependencies with:
make install
The options available are:
Usage:
-input string
Input file
-output string
Where to download the file (default "./")
You can build the application and run it or run it directly with:
go run cmd/cli/main.go -input <TORRENT_FILE_PATH> -output <TORRENT_FILE_OUTPUT>
<TORRENT_FILE_PATH>
is the file path of the torrent file, <TORRENT_FILE_OUTPUT>
is the output path that you intend the file to be downloaded to.
For example:
go run cmd/cli/main.go -input debian-11.4.0-amd64-netinst.iso.torrent -output debian.iso
Optionally, you can build the application
make build
# or
go build -o <OUTPUT_PATH> cmd/cli/main.go
This will build the application in the bin directory. If you use the second option to build the application, you can specify the
<OUTPUT_PATH>
directory.
Once done, you can use the binary as well:
tclient -input debian-10.2.0-amd64-netinst.iso.torrent -output debian.iso
This assumes the binary built is called
tclient
Tests have been written for the source code and can be validated with running:
make test
# or
go test ./...
Linting can be done using golanci-lint and setup is as below:
make setup-linting
Now run linting with:
make lint
Other commands can be found in the Makefile.
- Only supports .torrent files (no magnet links)
- Only supports HTTP trackers
- Does not support multi-file torrents
- Strictly leeches (does not support uploading pieces)
SemVer is used for versioning. For the versions available, see the tags in this repository.
View the project license here