bittorrent protocol implementation. bittorrent bittorrent is a widely used peer-to- peer network...

22
Bittorrent Protocol Implementation

Upload: amber-harmon

Post on 01-Jan-2016

229 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Bittorrent Protocol Implementation

Page 2: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Bittorrent

•Bittorrent is a widely used peer-to-peer network used to distribute files, especially large ones•It has a number of legal uses which separate it from other P2P

Page 3: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Traditional vs. Bittorrent

•One server provides many clients

•Many clients provide many clients

•Images from sitepoint.com

Page 4: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Explanation

•The .torrent file provides info about tracker URL, filename, size, and more•Client connects to tracker through URL•Tracker gives client a list of other clients•Client then downloads file from other clients (not a centralized server)•Periodic update with tracker for new client list

Page 5: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Purpose

• Create a Bittorrent client and make the underlying libraries and utilities available for further improvement and usage

Page 6: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Goals

•Analyze the Bittorrent protocol and create a workable implementation that can be used to download files through the Bittorrent network•Complete internet publishing solution using Bittorrent (torrent file, tracker, client)

Page 7: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Expected Results

•Utility to create .torrent metadata files•Parse .torrent files and connect to tracker•Tracker <==> Peer communication•Peer <==> Peer communication

Page 8: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Similar Projects

•Mainline Bittorrent client•Azureus Bittorrent client•Rakshasa libtorrent•Rasterbar libtorrent•python-libtorrent

Page 9: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Mainline Bittorrent Client

•Official client by creator of Bittorrent•Python•Open source•Sets the standard and extensions to the Bittorrent protocol

Page 10: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Azureus Bittorrent Client

•Very popular alternative client•Java•Open source•Lots of features, plugins, options•High memory usage and load on system

Page 11: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Rakshasa libtorrent

•Bittorrent development library•C++•Open source•Used to write rtorrent, high performance terminal client•Not very widespread usage

Page 12: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Rasterbar libtorrent

•Bittorrent development library•C++•Open source•Used by a number of Bittorrent clients•Mature and stable

Page 13: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

python-libtorrent

•Python wrapper for Rasterbar libtorrent•Developed for Deluge Bittorrent client•Beta software•No documentation

Page 14: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

libtorrent

•Attempted using Rakshasa and Rasterbar libtorrent•Lack of documentation and online help•Not as mature as desired•Overall slow progress

Page 15: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

.torrent File Specification

•Official document on bittorrent.org•Details the storage format of metadata in .torrent files•“Bencoded” strings, integers, lists, dictionaries to store metadata•Unicode and ASCII

Page 16: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Bencoding

•Integer: 6 => “i6e”•String: “hello” => “5:hello”•List: [“hello”,”world”] => “l5:hello5:worlde”•Dictionary: {“hello”:”world”} => “d5:hello5:worlde”

Page 17: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Bencoding implementation

•Python, good string manipulation•Structure of a .torrent file is a dictionary containing string keys and integer, string, list, and dictionary values•Recursion to encode•Stack to unencode

Page 18: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Download Client

•Attempted writing a client using both Rakshasa and Rasterbar libtorrent•Could download file based on proper .torrent file with Rakshasa•Could not compile Rasterbar•Lack of documentation hinders further progress

Page 19: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Future of the Client

•Continue work without documentation with either Rakshasa or Rasterbar libtorrent•Write own torrent library, which increases “research” aspect of project

Page 20: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Possible tests

•Create a .torrent and see if it can be used to download the file•Read in an external .torrent and see if is parsed correctly•Tracker <==> Peer communication is forthcoming, check of exchanged bencoded dictionaries

Page 21: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Preliminary Results

•Bencoded .torrent file creation and reading is very possible through the use of Python•Client using Rakshasa libtorrent can download, but future progress will be slow

Page 22: Bittorrent Protocol Implementation. Bittorrent Bittorrent is a widely used peer-to- peer network used to distribute files, especially large ones It has

Summary

•Bencoding torrent files•Torrent file structure and info•Libtorrent (Rakshasa, Rasterbar) clients are hard to implement•Probably will write own Bittorrent library in Python