1 # A command line bit-torrent client.
3 I started writing a bit torrent 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.
5 [![Join the chat at https://gitter.im/vu3rdd/functorrent](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/vu3rdd/functorrent?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
9 Functorrent can be build with [Stack](https://github.com/commercialhaskell/stack) or
10 [Nix](https://nixos.org/nix/). I personally test the build with Debian GNU/Linux and
11 OS X using FP Complete's stack.
15 Sandboxes give you per project independent containers, just like Python's
19 $ git clone https://github.com/vu3rdd/functorrent && cd functorrent
20 $ cabal install stack # or install stack by other means
21 $ stack build # binaries in $(pwd)/.stack-work/install/x86..../lts-2.16/7.8.4/bin/functorrent
25 ``$ nix-shell``` at the root of the source code repo should drop you into a
26 shell which has all the package dependencies installed.
31 [nix-shell] $ cabal configure && cabal build
35 If you invoke functorrent without any options, it expects the contents of a torrent file
36 to be given in stdin. So
38 $ cat ubuntu-14.10-desktop-amd64.iso.torrent | functorrent
41 Or one can explicitly specify the torrent file as input.
43 $ functorrent ubuntu-14.10-desktop-amd64.iso.torrent
48 - [Optimized for Fun](http://www.slideshare.net/autang/ofun-optimizing-for-fun).
49 (should have called it "funtorrent")
50 - Become more profient with Haskell.
51 - Implement something non-trivial with Haskell (crypto, file operations, network
52 operations, concurrency, bit twiddling, DHT).
53 - Follow the spec ([official spec](http://bittorrent.org/beps/bep_0003.html), [unofficial spec](https://wiki.theory.org/BitTorrentSpecification))
54 - Easy for newbies like me to read and understand alongside the spec.
55 - doctest and quickcheck tests.
56 - Follow Haskell Style Guide - https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
60 - most of the peer wire protocol works.
61 - talks only to one peer at the moment. Single threaded.
62 - can download files. But needs every piece to be served by the peer it connected to.
66 - this client is not usable as your daily bit torrent 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.
71 * Talk to multiple peers.
72 * Piece download algorithms.
73 * Concurrency (threads per peer)
74 * Multifile torrent support.
75 * other advanced features of Bit Torrent (like DHT).