Endtoend Publishing Using Bittorrent Bittorrent Bittorrent is a
End-to-end Publishing Using Bittorrent
Bittorrent • Bittorrent is a widely used peer-topeer network used to distribute files, especially large ones • It has a number of legal uses which separate it from other P 2 P
Practical Applications Distributing large files Podcasting Vlogging Disk images Legal distribution of movies (see bittorrent. com)
Traditional vs. Bittorrent • One server provides many clients • Many clients provide many clients
Terminology Swarm – clients downloading or uploading a given file through BIttorrent Tracker – centralized server that clients connect to to ask for lists of other clients connected to the swarm Seed – A client that has a complete copy of the file Peer (Leecher) – A client that does not have a complete copy of the file
Problem Torrents that are less popular may eventually “die” when there are no longer any complete copies of the file in the swarm
Everseed Permanent seed running on the same server as the tracker Guarantees that there will always be a complete copy of the file
Related Research The creator of Bittorrent wrote a paper on the process of downloading a file using Bittorrent at http: //www. bittorrent. org/protocol. html Maintainers of various Bittorrent clients wrote http: //wiki. theory. org/Bit. Torrent. Specification, which is like the official specification except far more in depth Osprey (http: //osprey. ibiblio. org/) seems to have thought of something similar, but haven't made much progress
Explanation • The. torrent metadata file provides info about where to find the tracker and about the file being distributed • Client connects to tracker • 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
Goals • Complete internet publishing solution using Bittorrent • Metadata file generator (. torrent) • Tracker • “Everseed” • Web interface
. torrent File • Official documention on bittorrent. org • Metadata on the file to be downloaded (tracker URL, filename, size, checksum hashes) • Stored as “bencoded” strings, integers, lists, dictionaries
Bencoding • Integer: 6 => “i 6 e” • String: “hello” => “ 5: hello” • List: [“hello”, ”world”] => “l 5: hello 5: worlde” • Dictionary: {“hello”: ”world”} => “d 5: hello 5: 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/decode
Tracker • Makes use of the bencoding algorithm • Handles two types of requests: “announce” and “scrape” • Stores data on peers and torrents in a SQLite database • No performance issues
Network performance Peer List Size
Database performance
Announce request Client sends an HTTP GET request to the announce URL in the. torrent file Tracker parses request, urldecodes data about the peer Tracker stores data in the database, sends appropriate response as bencoded string in a text/plain document Client bdecodes string, connects to other clients
Summary • Python • Benefits of P 2 P technology • “Everseed” concept • . torrent files and bencoding • Tracker
- Slides: 18