golang-sample-torrent-client-from-scratch

command module
v0.0.0-...-c8d2a3f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 5 Imported by: 0

README

Sample torrent client written in Go

Overview

This is a console app for downloading torrent-hosted content via *.torrent files.

Good parts
  • Very tiny and quick
  • No external libraries at all
  • Torrent-tracker implementation for local testing
  • Bencode package is ready for reuse
Missing parts
  • Big beautiful progress bar instead of the messages log
  • Seeding / Bitfield / HAVE
  • Game / randomization mode, it downloads pieces in order
  • No memory cache flushing
  • DHT

Usage

./golang-sample-torrent-client-from-scratch path/to/file.torrent
Sending started event to tracker http://localhost:26880/announce

Sending handshake {Handshake message id:-DF0001-ylipvsb5vE0g, h:23759d44a5d3c789555554ec916cc3269a23dffc} to {Peer h:127.0.0.1, p:50862}
Sending {Handshake message id:-DF0001-ylipvsb5vE0g, h:23759d44a5d3c789555554ec916cc3269a23dffc} to {Peer h:127.0.0.1, p:50862}
Successful handshake {Handshake message id:-DE13F0-DEDk-U0mNz7f, h:23759d44a5d3c789555554ec916cc3269a23dffc} with {Peer id:-DE13F0-DEDk-U0mNz7f, h:127.0.0.1, p:50862}

New {Wire message t:5, s:3} from {Peer id:-DE13F0-DEDk-U0mNz7f, h:127.0.0.1, p:50862}
Sending {Wire message t:2, s:0} to {Peer id:-DE13F0-DEDk-U0mNz7f, h:127.0.0.1, p:50862}
New {Wire message t:1, s:0} from {Peer id:-DE13F0-DEDk-U0mNz7f, h:127.0.0.1, p:50862}

I am UNCHOKED by {Peer id:-DE13F0-DEDk-U0mNz7f, h:127.0.0.1, p:50862}

Sending {Wire message t:6, s:12} to {Peer id:-DE13F0-DEDk-U0mNz7f, h:127.0.0.1, p:50862}
New {Wire message t:7, s:16392} from {Peer id:-DE13F0-DEDk-U0mNz7f, h:127.0.0.1, p:50862}
Sending {Wire message t:6, s:12} to {Peer id:-DE13F0-DEDk-U0mNz7f, h:127.0.0.1, p:50862}
New {Wire message t:7, s:16392} from {Peer id:-DE13F0-DEDk-U0mNz7f, h:127.0.0.1, p:50862}

Download complete! Writing files...
Sending stopped event to tracker http://localhost:26880/announce

Exiting.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL