Skip to content
A BitTorrent-like application. Contains client and tracker implementations.
Go Shell TeX
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
doc
src
tests
.gitignore
README.md
p3.pdf

README.md

ByteTorrent

Overview

  • A BitTorrent-like peer-to-peer application
  • Provides "client" and "tracker" implementations. The tracker mediates the exchange of file "chunks" by clients. "Torrents" associate file information with files on the tracker and client.
  • src/torrent/: Describe "Torrent" format. A torrent corresponds to exactly one data file, and contains information about that file:
    • the file's size
    • the hashes of the file's chunks
    • which trackers associate the file with this torrent
    • etc.
  • src/tracker/: Tracker is a cluster of nodes, replicated with Paxos. Tracker maintains a record of clients (identified by host:port) that claim to have chunks for torrents.
  • src/client/: Clients maintain a record of which files exist of a local file system, and which torrents correspond to these files. It can exchange chunks of these file with other clients.

Features

  • Trackers use Paxos for replication. Paxos implementation is resiliant to failures in which a node crashes as well as failures in which a node stalleds indefinitely before resuming.
  • Trackers keep logs of committed operations in order to bring previously stalled nodes back up to speed.
  • Torrents are identified by the hash of the associated data file, to make name collisions almost impossible. In the event of a name collision, a tracker will not allow a torrent to be created.
  • Torrents contain information about the hashes of chunks of associated data files. Clients check these hashes to ensure chunk integrity.

Usage Example:

  1. Client A has a file music.mp3 locally
  2. Client A CREATEs a torrent music.torrent for music.mp3
  3. Client A REGISTERs music.torrent with a tracker cluster. If it is successful, the tracker cluster will never associate other data file chunk hashes with this name.
  4. Client A OFFERs music.mp3, which informs the tracker that is has music.torrent and is ready to serve chunks.
  5. Client B finds music.torrent through conventional means.
  6. Client B DOWNLOADs music.mp3 by contacting the trackers listed in music.torrent, getting a list of clients which contain music.mp3 (possibly including Client A), and fetching chunks of music.mp3 clients.

Tests

  • test/end_to_end/multi_client_real_tracker_test.sh: 9 clients serve chunks of a data file to 1 client. A 3-node tracker cluster mediates.
  • test/end_to_end/multi_client_real_tracker_malicious_clients_test.sh: 4 honest clients and 5 malicious client serve chunks of a data file to 1 client. A 3-node tracker cluster mediates. The malicious nodes serve chunks with invalid hashes, and the received client must reject these chunks.
  • test/end_to_end/multi_client_real_tracker_fail_stop_test.sh: 9 clients serve chunks of a data file to 1 client. A 3-node tracker cluster mediates. One of the tracker nodes fails while the 9 nodes are informing the tracker cluster that they have chunks of the data file. This node does not recover.
  • test/end_to_end/multi_client_real_tracker_fail_stall_test.sh: 9 clients serve chunks of a data file to 1 client. A 3-node tracker cluster mediates. One of the tracker nodes goes offline while the 9 nodes are informing the tracker cluster that they have chunks of the data file. This node recovers after 5 seconds and is reintegrated into the cluster.
  • test/trackertest/trackertest.sh: Runs 11 tests to check that the paxos implementation works correctly. Tests include: a single tracker sending many messages to the cluster; dualing leaders; shutdown nodes for fail-stop testing; pause and resume a node.

Progress Since Grading Meeting:

  • Updated the testClosed and testClosedTwo functions in tests/trackertester/trackertester.go. The tracker now passes every time.
You can’t perform that action at this time.