functorrent.git
9 years agosupport for announce-list.
Ramakrishnan Muthukrishnan [Thu, 26 Mar 2015 10:48:07 +0000 (16:18 +0530)]
support for announce-list.

Some torrent files use announce-lists but then store list of lists,
each inner list containing just one string instead of list of strings.
(eg: data/ubuntu-14.10-desktop-amd64.iso.torrent stores it this way)

9 years agoHandle error cases from the tracker
Jaseem Abid [Sun, 29 Mar 2015 12:24:58 +0000 (17:54 +0530)]
Handle error cases from the tracker

Tracker might reply that the requested torrent is unavailable. Sample
response at `data/debian-7.8.0-amd64-CD-1.iso.error`.

Renamed `getPeerResponse` to `mkPeerResp` and changed it singture to
match other `mk*` functions like `mkMetaInfo`.

Added test cases

New checks made the code one more level deep. Will need a refactor with
the Either Monad.

9 years agoAdd directory & tasty as a library dependencies
Jaseem Abid [Sun, 29 Mar 2015 07:25:21 +0000 (12:55 +0530)]
Add directory & tasty as a library dependencies

9 years agoMerge pull request #19 from jaseemabid/master
Jaseem Abid [Sat, 28 Mar 2015 17:21:00 +0000 (22:51 +0530)]
Merge pull request #19 from jaseemabid/master

Cleanup a few bad types

9 years agoCleanup a few bad types
Jaseem Abid [Sat, 28 Mar 2015 11:22:02 +0000 (16:52 +0530)]
Cleanup a few bad types

1. Change type InfoDict from `Map BVal BVal` to `Map String BVal`

The keys are human readable keys like 'name', 'announce' etc and String
is the natural fit. This change also gets rid of a lot of packing
unpacking business.

Example:

    -infoHash :: Map BVal BVal -> ByteString
    -infoHash m = let info = m ! Bstr (pack "info")
    -             in (hash . pack . encode) info
    +infoHash :: InfoDict -> ByteString
    +infoHash m = hash . encode $ (m ! "info")

2. Change type of `encode` from `BVal -> String` to `BVal -> ByteString`

Encoded values might not be ASCII safe in the first place. Also, it
makes sense to be the inverse function of decode. `encode . decode` pair
might be a good candidate for Quickcheck.

Other changes are consequences of the type change. Fixed a bunch of
broken doctests in Bencode.

TIL haskell is kickass for refactoring!

9 years agoadd dependency on package "directory" to functorrent-test
Ramakrishnan Muthukrishnan [Fri, 27 Mar 2015 17:11:04 +0000 (22:41 +0530)]
add dependency on package "directory" to functorrent-test

9 years agoerror out if the input string is not a valid filepath
Ramakrishnan Muthukrishnan [Fri, 27 Mar 2015 05:50:41 +0000 (11:20 +0530)]
error out if the input string is not a valid filepath

9 years agoMerge pull request #15 from vu3rdd/14-hlint-0
Ramakrishnan Muthukrishnan [Tue, 24 Mar 2015 08:05:33 +0000 (13:35 +0530)]
Merge pull request #15 from vu3rdd/14-hlint-0

Run HLint as a test suite.

9 years agoFIlenames start with capital letters. hlint.hs -> HLint.hs
Ramakrishnan Muthukrishnan [Tue, 24 Mar 2015 08:04:10 +0000 (13:34 +0530)]
FIlenames start with capital letters. hlint.hs -> HLint.hs

9 years agotravis.yml: install "happy" which is a dependency for haskell-src-exts
Ramakrishnan Muthukrishnan [Tue, 24 Mar 2015 04:15:16 +0000 (09:45 +0530)]
travis.yml: install "happy" which is a dependency for haskell-src-exts

9 years agoRun HLint as a test suite.
Ramakrishnan Muthukrishnan [Mon, 23 Mar 2015 14:29:08 +0000 (19:59 +0530)]
Run HLint as a test suite.

9 years agoFix cabal dependencies
Jaseem Abid [Sun, 22 Mar 2015 19:42:58 +0000 (01:12 +0530)]
Fix cabal dependencies

9 years agoFix tracker response test
Jaseem Abid [Sun, 22 Mar 2015 18:00:46 +0000 (23:30 +0530)]
Fix tracker response test

9 years agoFix key error
Jaseem Abid [Sun, 22 Mar 2015 17:14:43 +0000 (22:44 +0530)]
Fix key error

9 years agoFix test which did file parsing on tracker response
Jaseem Abid [Sun, 22 Mar 2015 15:25:11 +0000 (20:55 +0530)]
Fix test which did file parsing on tracker response

Relates to #11

9 years agoREADME.md: hopefully correct image link this time
Ramakrishnan Muthukrishnan [Sun, 22 Mar 2015 02:02:04 +0000 (07:32 +0530)]
README.md: hopefully correct image link this time

9 years agoREADME.md: bang for the image link
Ramakrishnan Muthukrishnan [Sun, 22 Mar 2015 01:59:26 +0000 (07:29 +0530)]
README.md: bang for the image link

9 years agoREADME.md: messed up the markdown link syntax
Ramakrishnan Muthukrishnan [Sun, 22 Mar 2015 01:56:28 +0000 (07:26 +0530)]
README.md: messed up the markdown link syntax

9 years agoREADME -> README.md
Ramakrishnan Muthukrishnan [Sun, 22 Mar 2015 01:55:05 +0000 (07:25 +0530)]
README -> README.md

9 years agoREADME: add travis build/test status badge.
Ramakrishnan Muthukrishnan [Sun, 22 Mar 2015 01:52:02 +0000 (07:22 +0530)]
README: add travis build/test status badge.

9 years agoMerge pull request #12 from jaseemabid/master
Ramakrishnan Muthukrishnan [Sat, 21 Mar 2015 17:46:26 +0000 (23:16 +0530)]
Merge pull request #12 from jaseemabid/master

Add tests to functorrent

9 years agoAdd travis config
Jaseem Abid [Sat, 21 Mar 2015 16:47:40 +0000 (22:17 +0530)]
Add travis config

9 years agoTests for decode
Jaseem Abid [Sat, 21 Mar 2015 16:44:09 +0000 (22:14 +0530)]
Tests for decode

9 years agoRename getPeers -> peers
Jaseem Abid [Sat, 21 Mar 2015 16:36:28 +0000 (22:06 +0530)]
Rename getPeers -> peers

9 years agoRemove duplicate import
Jaseem Abid [Sat, 21 Mar 2015 15:57:57 +0000 (21:27 +0530)]
Remove duplicate import

9 years agoRemove dependency on time package
Jaseem Abid [Sat, 21 Mar 2015 14:40:22 +0000 (20:10 +0530)]
Remove dependency on time package

9 years agoMake functorrent a library and an executable
Jaseem Abid [Sat, 21 Mar 2015 14:02:57 +0000 (19:32 +0530)]
Make functorrent a library and an executable

This is a prerequisite for testing, as well as code organization.

1. `$ cabal repl` will build and import Functorrent library.
2. Making module exports explicit

9 years agoMerge pull request #10 from jaseemabid/master
Jaseem Abid [Wed, 18 Mar 2015 10:30:40 +0000 (16:00 +0530)]
Merge pull request #10 from jaseemabid/master

Make network request return ByteString

9 years agoMake network request return ByteString
Jaseem Abid [Sun, 15 Mar 2015 18:34:10 +0000 (00:04 +0530)]
Make network request return ByteString

Packing and unpacking curropted the binary data in several occations
when the network response was written to disk for caching/testing.

Add support for local caches. This aids in testing, and throttling
remote requests if the file is new enough.

Removes unwanted <$>

9 years agoMerge pull request #7 from dfordivam/master
Jaseem Abid [Mon, 2 Mar 2015 11:09:23 +0000 (16:39 +0530)]
Merge pull request #7 from dfordivam/master

Implemented logger

9 years agoFeedback from @jaseemabid, Fixes #6
Divam [Sun, 1 Mar 2015 15:10:13 +0000 (20:40 +0530)]
Feedback from @jaseemabid, Fixes #6

9 years agoLogger implementation code. Fixes #6. Logging to file remaining
Divam [Sat, 28 Feb 2015 16:08:11 +0000 (21:38 +0530)]
Logger implementation code. Fixes #6. Logging to file remaining

9 years agoMerge pull request #1 from vu3rdd/master
Divam [Mon, 23 Feb 2015 11:01:26 +0000 (16:31 +0530)]
Merge pull request #1 from vu3rdd/master

merge from vu3rdd

9 years agoMerge pull request #5 from jaseemabid/master
Ramakrishnan Muthukrishnan [Mon, 23 Feb 2015 05:19:53 +0000 (10:49 +0530)]
Merge pull request #5 from jaseemabid/master

Make `!` inline

9 years agoMake `!` inline
Jaseem Abid [Sun, 22 Feb 2015 17:04:44 +0000 (22:34 +0530)]
Make `!` inline

9 years agoMerge pull request #4 from jaseemabid/master
Ramakrishnan Muthukrishnan [Sun, 22 Feb 2015 14:25:37 +0000 (19:55 +0530)]
Merge pull request #4 from jaseemabid/master

Absolute imports, removing qualified imports

9 years agoFix failing test
Jaseem Abid [Sat, 21 Feb 2015 18:59:06 +0000 (00:29 +0530)]
Fix failing test

9 years agoAbsolute import everywhere, cleanup
Jaseem Abid [Sat, 21 Feb 2015 18:45:57 +0000 (00:15 +0530)]
Absolute import everywhere, cleanup

9 years agoMerge pull request #3 from jaseemabid/master
Ramakrishnan Muthukrishnan [Sat, 21 Feb 2015 16:43:50 +0000 (22:13 +0530)]
Merge pull request #3 from jaseemabid/master

Derive `show` automatically for BVal

9 years agoDerive `show` automatically for BVal
Jaseem Abid [Sat, 21 Feb 2015 13:01:33 +0000 (18:31 +0530)]
Derive `show` automatically for BVal

9 years agomore refactoring: type synonym for info dictionary
Ramakrishnan Muthukrishnan [Sat, 21 Feb 2015 03:55:15 +0000 (09:25 +0530)]
more refactoring: type synonym for info dictionary

9 years agomore refactoring around infohash
Ramakrishnan Muthukrishnan [Sat, 21 Feb 2015 03:43:45 +0000 (09:13 +0530)]
more refactoring around infohash

9 years agorefactor PeerID and associated functions.
Ramakrishnan Muthukrishnan [Sat, 21 Feb 2015 02:41:42 +0000 (08:11 +0530)]
refactor PeerID and associated functions.

Until now we were hashing peer id string to get a 20-byte hash. But
that's not needed. Peer ID is just a 20-byte string that needs to be
unique per client and sent to the tracker (and peers).

9 years agoWIP: peer handshake
Ramakrishnan Muthukrishnan [Fri, 20 Feb 2015 17:15:53 +0000 (22:45 +0530)]
WIP: peer handshake

9 years agoMerge pull request #2 from jaseemabid/master
Ramakrishnan Muthukrishnan [Thu, 19 Feb 2015 00:49:17 +0000 (06:19 +0530)]
Merge pull request #2 from jaseemabid/master

A few lint fixes to get started

9 years agoA few lint fixes to get started
Jaseem Abid [Wed, 18 Feb 2015 20:28:51 +0000 (01:58 +0530)]
A few lint fixes to get started

- Making `GHC -Wall` and hlint happy.
- Renaming length to len, to not shadow prelude function
- Remove unused import

9 years agoUpdate current status.
Ramakrishnan Muthukrishnan [Tue, 17 Feb 2015 13:02:36 +0000 (18:32 +0530)]
Update current status.

9 years agoHandle the `left' parameter for the tracker request.
Ramakrishnan Muthukrishnan [Tue, 17 Feb 2015 11:05:00 +0000 (16:35 +0530)]
Handle the `left' parameter for the tracker request.

Tracker initial request includes a parameter called `left' to indicate
the size of the file left to be downloaded. When we contact the tracker
initially, we haven't downloaded anything yet. So, the left parameter
should be the length parameter. For now, we handle only single file
torrent files, so we just pick the length param from Metainfo and shove
it in into the tracker http request.

9 years agoadd a TODO item on test suite
Ramakrishnan Muthukrishnan [Tue, 17 Feb 2015 09:38:44 +0000 (15:08 +0530)]
add a TODO item on test suite

9 years agocute hlint suggestion for transformng a function
Ramakrishnan Muthukrishnan [Tue, 17 Feb 2015 09:37:56 +0000 (15:07 +0530)]
cute hlint suggestion for transformng a function

9 years agofix changed made during sleep deprived state
Ramakrishnan Muthukrishnan [Tue, 17 Feb 2015 06:06:27 +0000 (11:36 +0530)]
fix changed made during sleep deprived state

9 years agoUse stackage
Ramakrishnan Muthukrishnan [Tue, 17 Feb 2015 00:58:28 +0000 (06:28 +0530)]
Use stackage

9 years agoincorporate hlint suggestions
Ramakrishnan Muthukrishnan [Tue, 17 Feb 2015 00:35:06 +0000 (06:05 +0530)]
incorporate hlint suggestions

9 years agofix broken links
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 14:04:26 +0000 (19:34 +0530)]
fix broken links

9 years agoproject renamed to "functorrent"
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 12:29:19 +0000 (17:59 +0530)]
project renamed to "functorrent"

9 years agomisc changes to fix warning
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 12:16:46 +0000 (17:46 +0530)]
misc changes to fix warning

9 years agoTODO: implement complete/incomplete fields
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 11:22:05 +0000 (16:52 +0530)]
TODO: implement complete/incomplete fields

9 years agorefactoring
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 11:08:10 +0000 (16:38 +0530)]
refactoring

9 years agohaskell style guide link and spec link
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 10:35:11 +0000 (16:05 +0530)]
haskell style guide link and spec link

9 years agoprint peer ip and port numbers
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 10:27:59 +0000 (15:57 +0530)]
print peer ip and port numbers

9 years agoupdate README with a note on tests
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 07:02:00 +0000 (12:32 +0530)]
update README with a note on tests

9 years agoupdate readme with goals and todos
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 05:28:15 +0000 (10:58 +0530)]
update readme with goals and todos

9 years agomore refactoring
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 05:27:52 +0000 (10:57 +0530)]
more refactoring

9 years agoadd some test torrent files
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 04:54:13 +0000 (10:24 +0530)]
add some test torrent files

9 years agorefactoring
Ramakrishnan Muthukrishnan [Mon, 16 Feb 2015 04:43:22 +0000 (10:13 +0530)]
refactoring

9 years agotalk to tracker and get the peer dict
Ramakrishnan Muthukrishnan [Sun, 15 Feb 2015 23:21:43 +0000 (04:51 +0530)]
talk to tracker and get the peer dict

9 years agoconvert to base16 (hex) before doing urlencode
Ramakrishnan Muthukrishnan [Sun, 15 Feb 2015 23:20:51 +0000 (04:50 +0530)]
convert to base16 (hex) before doing urlencode

9 years agoWIP: tracker protocol
Ramakrishnan Muthukrishnan [Sun, 15 Feb 2015 16:19:18 +0000 (21:49 +0530)]
WIP: tracker protocol

9 years agorefactor urlEncode
Ramakrishnan Muthukrishnan [Sun, 15 Feb 2015 10:17:32 +0000 (15:47 +0530)]
refactor urlEncode

9 years agourlencoding: ByteString -> String
Ramakrishnan Muthukrishnan [Sun, 15 Feb 2015 08:13:02 +0000 (13:43 +0530)]
urlencoding: ByteString -> String

9 years agofirst attempt (buggy) at urlencode
Ramakrishnan Muthukrishnan [Sun, 15 Feb 2015 07:34:55 +0000 (13:04 +0530)]
first attempt (buggy) at urlencode

9 years agominor formatting
Ramakrishnan Muthukrishnan [Thu, 12 Feb 2015 14:43:38 +0000 (20:13 +0530)]
minor formatting

9 years agoinfo hash calculation
Ramakrishnan Muthukrishnan [Thu, 12 Feb 2015 14:34:05 +0000 (20:04 +0530)]
info hash calculation

9 years agoencode with tests
Ramakrishnan Muthukrishnan [Thu, 12 Feb 2015 12:12:21 +0000 (17:42 +0530)]
encode with tests

9 years agoWIP: impement benc encoding, needed for infohash computation
Ramakrishnan Muthukrishnan [Thu, 12 Feb 2015 06:34:55 +0000 (12:04 +0530)]
WIP: impement benc encoding, needed for infohash computation

9 years agoWIP: Johan Tibbel's haskell style guide compliance.
Ramakrishnan Muthukrishnan [Wed, 11 Feb 2015 15:44:26 +0000 (21:14 +0530)]
WIP: Johan Tibbel's haskell style guide compliance.

https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md

9 years agoWIP: tracker interactions
Ramakrishnan Muthukrishnan [Tue, 10 Feb 2015 06:36:24 +0000 (12:06 +0530)]
WIP: tracker interactions

9 years agoHTTP client library dependency
Ramakrishnan Muthukrishnan [Tue, 10 Feb 2015 06:23:51 +0000 (11:53 +0530)]
HTTP client library dependency

9 years agoparse and print Metainfo
Ramakrishnan Muthukrishnan [Thu, 5 Feb 2015 09:21:44 +0000 (14:51 +0530)]
parse and print Metainfo

9 years agoWIP: Main
Ramakrishnan Muthukrishnan [Thu, 5 Feb 2015 07:28:44 +0000 (12:58 +0530)]
WIP: Main

9 years agotypos and correct module namespacing
Ramakrishnan Muthukrishnan [Thu, 5 Feb 2015 01:09:12 +0000 (06:39 +0530)]
typos and correct module namespacing

9 years agoWIP: mkMetaInfo
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 16:23:26 +0000 (21:53 +0530)]
WIP: mkMetaInfo

9 years agoWIP: info record
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 15:55:06 +0000 (21:25 +0530)]
WIP: info record

9 years agoWIP: metainfo record
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 15:40:51 +0000 (21:10 +0530)]
WIP: metainfo record

9 years agoWIP: create MetaInfo structure from torrentfile
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 15:31:20 +0000 (21:01 +0530)]
WIP: create MetaInfo structure from torrentfile

9 years agodict tests
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 13:06:47 +0000 (18:36 +0530)]
dict tests

9 years agolists: more tests
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 11:56:12 +0000 (17:26 +0530)]
lists: more tests

9 years agoAdd Strings, instance of the Show typeclass.
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 11:30:23 +0000 (17:00 +0530)]
Add Strings, instance of the Show typeclass.

9 years agorearrange and refactor code for readability and comprehension.
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 11:05:24 +0000 (16:35 +0530)]
rearrange and refactor code for readability and comprehension.

9 years agomuch better handling of bencode integers
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 09:32:16 +0000 (15:02 +0530)]
much better handling of bencode integers

9 years agoadd dictionary definition of deluge
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 07:48:57 +0000 (13:18 +0530)]
add dictionary definition of deluge

9 years agoadd a README
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 07:47:23 +0000 (13:17 +0530)]
add a README

9 years agocorrectly handle negative/zero integers
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 04:25:13 +0000 (09:55 +0530)]
correctly handle negative/zero integers

9 years agoinitial parser for integers
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 03:51:22 +0000 (09:21 +0530)]
initial parser for integers

9 years agoWIP: just experimenting
Ramakrishnan Muthukrishnan [Wed, 4 Feb 2015 01:47:32 +0000 (07:17 +0530)]
WIP: just experimenting

9 years agoparser for strings
Ramakrishnan Muthukrishnan [Tue, 3 Feb 2015 23:56:12 +0000 (05:26 +0530)]
parser for strings

9 years agoadd build-dependency for doctest
Ramakrishnan Muthukrishnan [Tue, 3 Feb 2015 23:41:09 +0000 (05:11 +0530)]
add build-dependency for doctest

9 years agoMain program
Ramakrishnan Muthukrishnan [Tue, 3 Feb 2015 23:26:27 +0000 (04:56 +0530)]
Main program

9 years agomore ghc options, parsec instead of attoparsec
Ramakrishnan Muthukrishnan [Tue, 3 Feb 2015 09:49:49 +0000 (15:19 +0530)]
more ghc options, parsec instead of attoparsec

9 years agoadd dependencies
Ramakrishnan Muthukrishnan [Tue, 3 Feb 2015 09:23:35 +0000 (14:53 +0530)]
add dependencies