Skip to content

jhelison/go-torrent

Repository files navigation

GitHub License GitHub release (with filter)


Go Torrent

A small and optimized go torrent downloader

About The Project

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

(back to top)

Built With

One of the most awesome things about this project, is that it's was built using GO!

(back to top)

Getting Started

No pre-requisites are necessary to run Go Torrent.

Installation

You have two options to get Go Torrent running:

  • Downloading the binaries
  • Build from source

Downloading Binaries from GitHub Releases

  1. Visit the Releases page of the go-torrent GitHub repository.

  2. Choose the latest release.

  3. Under "Assets", download the appropriate binary for your operating system (Linux, Mac, Windows).

  4. After downloading, you may need to grant execution permissions to the binary. For Linux or Mac, use:

chmod +x go-torrent
  1. Place the binary in a directory within your PATH for easy access.

Build from source

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:

  1. Clone the repository from GitHub:
git clone https://github.com/jhelison/go-torrent.git
  1. Navigate to the cloned directory:
cd go-torrent
  1. Build the application:
make build

or

mkdir build
go build -o build
  1. Place the binary in a directory within your PATH for easy access.

Usage

Configuration

  • 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.

Basic Commands

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

(back to top)

Roadmap

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

(back to top)

Contributing

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 😊

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Jhelison Uchoa - Linkedin - [email protected]

(back to top)

Acknowledgments

Use this space to list resources you find helpful and would like to give credit to.

(back to top)