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)
7 [![Build Status](https://travis-ci.org/vu3rdd/functorrent.svg?branch=master)](https://travis-ci.org/vu3rdd/functorrent)
11 Functorrent can be build with [Stack](https://github.com/commercialhaskell/stack) or
12 [Nix](https://nixos.org/nix/).
16 Sandboxes give you per project independent containers, just like Python's
20 $ git clone https://github.com/vu3rdd/functorrent && cd functorrent
21 $ cabal install stack # or install stack by other means
22 $ stack build # binaries in $(pwd)/.stack-work/install/x86..../lts-2.16/7.8.4/bin/functorrent
26 ``$ nix-shell``` at the root of the source code repo should drop you into a
27 shell which has all the package dependencies installed.
32 [nix-shell] $ cabal configure && cabal build
36 If you invoke functorrent without any options, it expects the contents of a torrent file
37 to be given in stdin. So
39 $ cat ubuntu-14.10-desktop-amd64.iso.torrent | functorrent
42 Or one can explicitly specify the torrent file as input.
44 $ functorrent ubuntu-14.10-desktop-amd64.iso.torrent
49 - [Optimized for Fun](http://www.slideshare.net/autang/ofun-optimizing-for-fun).
50 (should have called it "funtorrent")
51 - Become more profient with Haskell.
52 - Implement something non-trivial with Haskell (crypto, file operations, network
53 operations, concurrency, bit twiddling, DHT).
54 - Follow the spec ([official spec](http://bittorrent.org/beps/bep_0003.html), [unofficial spec](https://wiki.theory.org/BitTorrentSpecification))
55 - Easy for newbies like me to read and understand alongside the spec.
56 - doctest and quickcheck tests.
57 - Follow Haskell Style Guide - https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
61 - most of the peer wire protocol works.
62 - talks only to one peer at the moment. Single threaded.
63 - can download files. But needs every piece to be served by the peer it connected to.
67 - 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.
72 * Talk to multiple peers.
73 * Piece download algorithms.
74 * Concurrency (threads per peer)
75 * Multifile torrent support.
76 * other advanced features of Bit Torrent (like DHT).