diff options
Diffstat (limited to 'src/Network/DHT/Kademlia.hs')
-rw-r--r-- | src/Network/DHT/Kademlia.hs | 65 |
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 #-} | ||
2 | module Network.DHT.Kademlia | ||
3 | ( | ||
4 | ) where | ||
5 | |||
6 | import Data.ByteString | ||
7 | import Network | ||
8 | import Remote.KRPC | ||
9 | |||
10 | import 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 | -- | ||
18 | type NodeID = ByteString | ||
19 | |||
20 | type NodeAddr = ByteString | ||
21 | type InfoHash = ByteString | ||
22 | type 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 | -- | ||
32 | ping :: Method NodeID NodeID | ||
33 | ping = method "ping" ["id"] ["id"] | ||
34 | |||
35 | |||
36 | |||
37 | -- | Used to lookup peer ID from node ID. | ||
38 | -- | ||
39 | find_node :: Method (NodeID, NodeID) (NodeID, NodeContact) | ||
40 | find_node = method "find_node" ["id", "target"] ["id", "nodes"] | ||
41 | |||
42 | -- | | ||
43 | announce_peer :: Method (NodeID, InfoHash, PortNumber, Token) NodeID | ||
44 | announce_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 | -- | ||
50 | genNodeID :: IO NodeID | ||
51 | genNodeID = randomIO | ||
52 | |||
53 | {- | ||
54 | type Token = Int | ||
55 | |||
56 | get_peers :: Method (NodeId :*: InfoHash) (NodeId, Token, NodeAddr :|: NodeAddr) | ||
57 | get_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 | ||