summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-06-20 23:10:06 +0400
committerSam T <pxqr.sta@gmail.com>2013-06-20 23:10:06 +0400
commit086e81d141c0e2435563b2b59e8065dcd27ce5a2 (patch)
tree24fb2d202e266332d4f1261f337544afce940290 /src/Network/BitTorrent
parent20108497bab46bf0d92fdf55255a77c8706efae5 (diff)
~ Merge kademlia package.
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r--src/Network/BitTorrent/DHT.hs14
-rw-r--r--src/Network/BitTorrent/DHT/Server.hs28
2 files changed, 42 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/DHT.hs b/src/Network/BitTorrent/DHT.hs
new file mode 100644
index 00000000..2d2073f0
--- /dev/null
+++ b/src/Network/BitTorrent/DHT.hs
@@ -0,0 +1,14 @@
1{-# LANGUAGE OverloadedStrings #-}
2module Network.BitTorrent.DHT
3 (
4 ) where
5
6import Data.ByteString
7import Network
8
9import Data.Kademlia.Routing.Table
10
11--type DHT k v = StateT (Table k v) IO
12
13--findNode :: NodeID -> DHT k v [NodeInfo]
14--findNode = undefined \ No newline at end of file
diff --git a/src/Network/BitTorrent/DHT/Server.hs b/src/Network/BitTorrent/DHT/Server.hs
new file mode 100644
index 00000000..1f73af8a
--- /dev/null
+++ b/src/Network/BitTorrent/DHT/Server.hs
@@ -0,0 +1,28 @@
1module Network.BitTorrent.DHT.Server
2 (
3 ) where
4
5import Control.Monad.Trans.State
6import Data.Kademlia.Routing.Table
7import Data.Kademlia.Common
8
9
10
11type DHT k v = StateT (Table NodeInfo InfoHash) IO
12
13ping :: NodeID -> DHT k v NodeID
14ping nid = do
15-- update nid
16-- gets nodeID
17 undefined
18
19findNode :: NodeID -> DHT k v [NodeInfo]
20findNode = undefined
21
22-- | Bittorrent /get_peers/ RPC is special case of the /find_value/.
23findValue :: NodeID -> DHT k v (Either [NodeID] v)
24findValue = undefined
25
26-- | Bittorrent /announce_peer/ RPC is special case of the /store/.
27store :: NodeID -> (k, v) -> DHT k v NodeID
28store = undefined \ No newline at end of file