summaryrefslogtreecommitdiff
path: root/src/Network/DHT/Kademlia.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/DHT/Kademlia.hs')
-rw-r--r--src/Network/DHT/Kademlia.hs65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/Network/DHT/Kademlia.hs b/src/Network/DHT/Kademlia.hs
deleted file mode 100644
index bc03ac16..00000000
--- a/src/Network/DHT/Kademlia.hs
+++ /dev/null
@@ -1,65 +0,0 @@
1{-# LANGUAGE OverloadedStrings #-}
2module Network.DHT.Kademlia
3 (
4 ) where
5
6import Data.ByteString
7import Network
8import Remote.KRPC
9
10import Data.Kademlia.Routing.Table
11{-
12
13-- | Global unique identifier of the node. Size of the identifier
14-- should(!) be equal to the size of DHT keys. This limitation arises
15-- from the design of Kademlia: we should estimate distance between
16-- keys and NodeId in routing algorithms.
17--
18type NodeID = ByteString
19
20type NodeAddr = ByteString
21type InfoHash = ByteString
22type Token = ByteString
23
24-- | Used to check out if a node is alive or not. This has a tow-fold effect:
25--
26-- * If(!) caller get response it should update the bucket
27-- corresponding to the callee.
28--
29-- * Callee of the ping should update the bucket corresponding
30-- to the caller as well.
31--
32ping :: Method NodeID NodeID
33ping = method "ping" ["id"] ["id"]
34
35
36
37-- | Used to lookup peer ID from node ID.
38--
39find_node :: Method (NodeID, NodeID) (NodeID, NodeContact)
40find_node = method "find_node" ["id", "target"] ["id", "nodes"]
41
42-- |
43announce_peer :: Method (NodeID, InfoHash, PortNumber, Token) NodeID
44announce_peer = undefined
45
46-- WARN is the 'system' random suitable for this?
47-- | Generate random NodeID used for the entire session.
48-- Distribution of ID's should be as uniform as possible.
49--
50genNodeID :: IO NodeID
51genNodeID = randomIO
52
53{-
54type Token = Int
55
56get_peers :: Method (NodeId :*: InfoHash) (NodeId, Token, NodeAddr :|: NodeAddr)
57get_peers = method "get_peers"
58 ("id", "target")
59 ("id", "token", view ("values" :|: "nodes"))
60
61
62
63
64-}
65-} \ No newline at end of file