]> git.rkrishnan.org Git - functorrent.git/blob - README.md
bit torrent -> BitTorrent
[functorrent.git] / README.md
1 # A command line BitTorrent client.
2
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.
4
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)
6
7 ## Building
8
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.
12
13 ### Stack
14
15 Sandboxes give you per project independent containers, just like Python's
16 virtualenv.
17
18
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
22
23 ### Building with Nix
24
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.
27
28
29     $ nix-shell --pure
30     [...]
31     [nix-shell] $ cabal configure && cabal build
32
33 ### Usage
34
35 If you invoke functorrent without any options, it expects the contents of a torrent file
36 to be given in stdin. So
37
38 $ cat ubuntu-14.10-desktop-amd64.iso.torrent | functorrent
39 [....]
40
41 Or one can explicitly specify the torrent file as input.
42
43 $ functorrent ubuntu-14.10-desktop-amd64.iso.torrent
44 [...]
45
46 ## Goals
47
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
57
58 ## Current Status
59
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.
63
64 ## WARNING
65
66 - 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.
67
68 ## TODO
69
70 *    Test suite.
71 *    Talk to multiple peers.
72 *    Piece download algorithms.
73 *    Concurrency (threads per peer)
74 *    Multifile torrent support.
75 *    other advanced features of BitTorrent (like DHT).