Skip to content

adityachauhan0/go-torrent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Torrent

A modular BitTorrent client implementation in Go, following the BEP 3 specification. image

Features

  • Magnet Link Support: Full implementation of BEP 9 (Metadata Exchange) and BEP 5 (DHT) for magnet downloads.
  • Modern Web UI: A futuristic, interactive dashboard built with React, Vite, and Three.js.
  • Real-Time Stats: Live monitoring of download/upload speeds, active peers, and progress.
  • File Upload: Support for uploading .torrent files directly via the UI.
  • Bencode Parsing: Robust encoder/decoder for bencoded data.
  • Torrent Parsing: Support for single and multi-file torrents.
  • Tracker Communication: HTTP and UDP tracker support.
  • Peer Wire Protocol: Full implementation (Handshake, Bitfield, Choke/Unchoke, Interested, Request, Piece).

Prerequisites

  • Go 1.25 or later
  • Node.js & npm (for Web UI)

Installation

  1. Clone the repository:

    git clone https://github.com/valhalla/go-torrent.git
    cd go-torrent
  2. Build the backend:

    go mod tidy
    go build -o torrent-client ./cmd/client
  3. Setup the Frontend:

    cd web
    npm install
    npm run build
    cd ..

Usage

Web Interface (Recommended)

Start the server:

./torrent-client serve --port 8080

Then open http://localhost:5173 (if running dev server) or serve the static files (if configured). Note: The current dev setup requires running npm run dev in the web/ directory parallel to the backend.

CLI Mode

Run the client by providing the path to a .torrent file:

./torrent-client <path_to_torrent_file> <output_directory>

Or for magnet links:

./torrent-client magnet "<magnet_link>" <output_directory>

Status

This project has evolved into a fully functional BitTorrent client with:

  • Standard HTTP & UDP Trackers
  • DHT (Distributed Hash Table) for peer discovery
  • Magnet Link Support (Metadata Exchange)
  • Modern Web Dashboard
  • File Uploads

About

Concurrent P2P BitTorrent engine built from scratch in Go, featuring a custom recursive parser and robust state-machine peer management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages