diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-07-10 01:55:36 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-07-10 01:55:36 +0400 |
commit | 9f27a6ebd6913c60457c2ecb9a053de66bd2327a (patch) | |
tree | 435b23beb0af898ac80c7b266320abc8bccd87ee /src/Network/BitTorrent/DHT.hs | |
parent | 1d33720a9383dac585606c726c982b761f8711c5 (diff) |
+ Add DHT node Id generation.
Diffstat (limited to 'src/Network/BitTorrent/DHT.hs')
-rw-r--r-- | src/Network/BitTorrent/DHT.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/DHT.hs b/src/Network/BitTorrent/DHT.hs index 3be7cfa0..2e8164bd 100644 --- a/src/Network/BitTorrent/DHT.hs +++ b/src/Network/BitTorrent/DHT.hs | |||
@@ -23,14 +23,13 @@ import Data.Maybe | |||
23 | import Data.List as L | 23 | import Data.List as L |
24 | import Data.Map as M | 24 | import Data.Map as M |
25 | import Data.HashMap.Strict as HM | 25 | import Data.HashMap.Strict as HM |
26 | |||
27 | import Network | 26 | import Network |
28 | import Network.Socket | 27 | import Network.Socket |
29 | import Remote.KRPC | 28 | import System.Entropy |
30 | 29 | ||
30 | import Remote.KRPC | ||
31 | import Data.BEncode | 31 | import Data.BEncode |
32 | import Data.Torrent | 32 | import Data.Torrent |
33 | import Data.Kademlia.Routing.Table | ||
34 | import Network.BitTorrent.Peer | 33 | import Network.BitTorrent.Peer |
35 | 34 | ||
36 | {----------------------------------------------------------------------- | 35 | {----------------------------------------------------------------------- |
@@ -44,7 +43,7 @@ type NodeId = ByteString | |||
44 | -- Distribution of ID's should be as uniform as possible. | 43 | -- Distribution of ID's should be as uniform as possible. |
45 | -- | 44 | -- |
46 | genNodeID :: IO NodeId | 45 | genNodeID :: IO NodeId |
47 | genNodeID = undefined -- randomIO | 46 | genNodeID = getEntropy 20 |
48 | 47 | ||
49 | instance Serialize PortNumber where | 48 | instance Serialize PortNumber where |
50 | get = fromIntegral <$> getWord16be | 49 | get = fromIntegral <$> getWord16be |