230 likes | 268 Views
Bittorrent Protocol Implementation. 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. Traditional vs. Bittorrent. One server provides many clients.
E N D
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
Traditional vs. Bittorrent One server provides many clients • Many clients provide many clients • Images from sitepoint.com
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
Purpose Create a Bittorrent client and make the underlying libraries and utilities available for further improvement and usage
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)
Expected Results Utility to create .torrent metadata files Parse .torrent files and connect to tracker Tracker <==> Peer communication Peer <==> Peer communication
Similar Projects Mainline Bittorrent client Azureus Bittorrent client Rakshasa libtorrent Rasterbar libtorrent python-libtorrent
Mainline Bittorrent Client Official client by creator of Bittorrent Python Open source Sets the standard and extensions to the Bittorrent protocol
Azureus Bittorrent Client Very popular alternative client Java Open source Lots of features, plugins, options High memory usage and load on system
Rakshasa libtorrent Bittorrent development library C++ Open source Used to write rtorrent, high performance terminal client Not very widespread usage
Rasterbar libtorrent Bittorrent development library C++ Open source Used by a number of Bittorrent clients Mature and stable
python-libtorrent Python wrapper for Rasterbar libtorrent Developed for Deluge Bittorrent client Beta software No documentation
libtorrent Attempted using Rakshasa and Rasterbar libtorrent Lack of documentation and online help Not as mature as desired Overall slow progress
.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
Bencoding Integer: 6 => “i6e” String: “hello” => “5:hello” List: [“hello”,”world”] => “l5:hello5:worlde” Dictionary: {“hello”:”world”} => “d5:hello5:worlde”
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
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
Future of the Client Continue work without documentation with either Rakshasa or Rasterbar libtorrent Write own torrent library, which increases “research” aspect of project
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
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
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