1 # A command line BitTorrent client.
3 I started writing a BitTorrent client because it seemed like fun and I am learning Haskell and wanted to see if I can write something real with Haskell than just heat the room. It is turning out to be a lot of fun.
7 You need to install [Stack](https://github.com/commercialhaskell/stack), either via
8 the OS package manager or via `cabal` (`cabal install stack`).
10 $ git clone https://github.com/vu3rdd/functorrent && cd functorrent
11 $ cabal install stack # or install stack by other means
12 $ stack build # binaries in $(pwd)/.stack-work/install/x86..../lts-2.16/7.8.4/bin/functorrent
16 If you invoke functorrent without any options, it expects the contents of a torrent file
17 to be given in stdin. So
19 $ cat ubuntu-14.10-desktop-amd64.iso.torrent | functorrent
22 Or one can explicitly specify the torrent file as input.
24 $ functorrent ubuntu-14.10-desktop-amd64.iso.torrent
29 - [Optimized for Fun](http://www.slideshare.net/autang/ofun-optimizing-for-fun).
30 (should have called it "funtorrent")
31 - Become more profient with Haskell.
32 - Implement something non-trivial with Haskell (crypto, file operations, network
33 operations, concurrency, bit twiddling, DHT).
34 - Follow the spec ([official spec](http://bittorrent.org/beps/bep_0003.html), [unofficial spec](https://wiki.theory.org/BitTorrentSpecification))
35 - Easy for newbies like me to read and understand alongside the spec.
36 - doctest and quickcheck tests.
37 - Follow Haskell Style Guide - https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
41 - most of the peer wire protocol works.
42 - talks only to one peer at the moment. Single threaded.
43 - can download files. But needs every piece to be served by the peer it connected to.
47 This client is not usable as your daily BitTorrent client yet. You may get corrupted files and end up wasting a lot of bandwidth. So, until we achieve some robustness, consider this as a programmer-friendly project to learn about a bunch of stuff.
52 * Talk to multiple peers.
53 * Piece download algorithms.
54 * Concurrency (threads per peer)
55 * Multifile torrent support.
56 * other advanced features of BitTorrent (like DHT).