Skip to content

JoelVCrasta/clover-torrent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

123 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Clover

Clover (πŸ€) is a lightweight, fast, leech-only torrent client written in Go. It implements the core BitTorrent protocol to download torrents directly from the terminal. It handles everything from parsing .torrent files and discovering peers to managing concurrent piece downloads.

Features

  • Torrent parsing - Implements an encoder and decoder for parsing bencode encoded .torrent files.
  • Dual peer discovery - Finds peers via both UDP trackers and the DHT network, merging them into a single stream.
  • Concurrent downloads - Manages multiple peer connections to download pieces simultaneously.
  • Clean CLI stats - Real-time stats showing a progress bar, percentage completed, pieces downloaded, active peer count, and time elapsed.

Getting Started

Prerequisites

  • Go

Installation

git clone https://github.com/JoelVCrasta/clover.git
cd clover
go build ./cmd/clover

Make sure to move the clover binary to your system or user bin folder so it works from anywhere.

In Linux:

sudo mv ./clover /usr/local/bin/

Usage/Examples

Usage

go run ./cmd/clover/main.go -i <path-to-torrent-file> -o <output-directory>

or

clover -i <path-to-torrent-file> -o <output-directory>

Examples

go run ./cmd/clover/main.go -i ~/downloads/ubuntu.torrent -o ~/downloads/

or

clover -i ~/downloads/ubuntu.torrent -o ~/downloads/
go run ./cmd/clover/main.go -i ~/downloads/ubuntu.torrent

or

clover -i ~/downloads/ubuntu.torrent

If the output flag is not provided, then it will download to the ~/Downloads directory.

Project Structure

.
β”œβ”€β”€ client
β”‚   β”œβ”€β”€ bitfield.go
β”‚   └── client.go
β”œβ”€β”€ cmd
β”‚   β”œβ”€β”€ clover
β”‚   β”‚   └── main.go
β”‚   └── example
β”‚       └── main.go
β”œβ”€β”€ config
β”‚   └── config.go
β”œβ”€β”€ dht
β”‚   └── dht.go
β”œβ”€β”€ download
β”‚   β”œβ”€β”€ download.go
β”‚   └── save.go
β”œβ”€β”€ handshake
β”‚   └── handshake.go
β”œβ”€β”€ message
β”‚   └── message.go
β”œβ”€β”€ metainfo
β”‚   β”œβ”€β”€ decode.go
β”‚   β”œβ”€β”€ encode.go
β”‚   β”œβ”€β”€ hash.go
β”‚   └── torrentfile.go
β”œβ”€β”€ peer
β”‚   β”œβ”€β”€ peer.go
β”‚   └── peer_id.go
β”œβ”€β”€β”€ tracker
β”‚   β”œβ”€β”€ scrape.go
β”‚   β”œβ”€β”€ tracker.go
β”‚   └── tracker_test.go
β”œβ”€β”€ torrent.go
β”œβ”€β”€ discover_peers.go
β”œβ”€β”€ go.mod
└── go.sum

About

πŸ€ A lightweight and fast torrent client written in Go.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages