This is a Go implementation based on the guide from Jessi Li with a few improvements.
Here's what we encompass in this project:
- Bencode parser 📃
- P2p torrent download using Bittorrent protocols 🔒
- Cobra CLI and Viper configuration 🔧
From Jessi Li orinals implementation we have the following:
- Chunk based file writes
- Viper and Cobra 🤖
- Improvements on memory management 🏎️
- Better pieces handling
One of the most awesome things about this project, is that it's was built using GO!
No pre-requisites are necessary to run Go Torrent.
You have two options to get Go Torrent running:
- Downloading the binaries
- Build from source
-
Visit the Releases page of the go-torrent GitHub repository.
-
Choose the latest release.
-
Under "Assets", download the appropriate binary for your operating system (Linux, Mac, Windows).
-
After downloading, you may need to grant execution permissions to the binary. For Linux or Mac, use:
chmod +x go-torrent
- Place the binary in a directory within your PATH for easy access.
Prerequisites:
- Ensure you have Go installed on your system. You can download it from the official Go website.
To install go-torrent from source, follow these steps:
- Clone the repository from GitHub:
git clone https://github.com/jhelison/go-torrent.git
- Navigate to the cloned directory:
cd go-torrent
- Build the application:
make build
or
mkdir build
go build -o build
- Place the binary in a directory within your PATH for easy access.
go-torrent
uses a configuration file located at $HOME/.go-torrent.toml. If this file does not exist, the program will create a default one on first run.- You can modify this file to change settings like download path, log level, and peer settings.
To start go-torrent, simply run the binary:
go-torrent
To download a torrent file, use the download
command followed by the path to the torrent file:
go-torrent download /path/to/torrentfile.torrent
You can specify the output directory for downloads using the --output
flag:
go-torrent download /path/to/torrentfile.torrent --output /path/to/download/directory
Global flags
- Specify a custom configuration file:
go-torrent --config /path/to/config.toml
- Set the log level (trace|info|warn|err|disabled):
go-torrent --log-level info
Still lot's to be done!
- Improve tests
- Multi-file torrent
- Add magnetic link support
- Add multi-torrent download
- Improve peer management
- Multithread management
- Peers refetch and retry
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
Don't forget to use conventional comments and write a good Pull Request 😊
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Jhelison Uchoa - Linkedin - [email protected]
Use this space to list resources you find helpful and would like to give credit to.