Skip to content

Latest commit

 

History

History
100 lines (62 loc) · 2.62 KB

README.md

File metadata and controls

100 lines (62 loc) · 2.62 KB

Go Report Card CircleCI

beetee

Bittorrent Client implemented in Go Work in Progress. I have a blog post outlining the protocol in dialog format here.

$ ./beetee -file=linux.torrent

beetee, commandline torrent application. Usage:
  -file string
        path to torrent file
  -peers int
        max peer connections (default 30)
  -seed
        keep running after download completes

Thanks @kracekumar, @alex-segura, and @nschuc, fellow Recursers, for all your help :)

====

Functionality:

  • allow multiple file-torrents
  • allow multiple dir-torrents
  • parse pieces
  • put into pieces struct
  • barse Have and BitField
  • begin Unit and Integration Tests
  • implement UDP and HTTP tracker
  • control peer flow/ask for more peers

Downloading

  • ask peer for index
  • only ask peer if they have it
  • write test for last piece download
  • ask for rarest blocks first

blocks

  • put that block into piece by index
  • concat blocks into data field

Write to disk

  • manage blocks
  • write to disk
  • write to disk gradually
  • read when incomplete and put into pieces

Uploading

  • run server
  • allow handshake
  • parse request
  • send blocks
  • construct bitfield from pieces

====

Package Organisation:

torrent

Torrent/meta/info structs and parse method. The torrent file provides the list of pieces.

tracker

Tracker struct and Response method. The tracker provides a list of peers.

message

Handshake, individual message decoder and message constructor.

peer

Peer struct, connect and Listen method. Also, the message decode switch for payloads is here. This file is mostly IO for the peer sockets.

server

Server struct and Listen method.

piece

Piece/Block struct and piece parser from torrent info. Also piece validator and helper functions for parsing the last piece/blocks in a download.

io

Writing and reading to disk.

For testing, here are the checksums for the torrent files provided in torrents/ Note: this Torrent file is for an older version of Arch; go to their website and get the newer torrent file/md5sum if you plan to use for installing onto your computer.:

17643c29e3c4609818f26becf76d29a3 > Ubuntu
47672450bcda8acf0c8512bd5b543cc0 > Arch

Untested Functionality:

  • UDP tracker