summaryrefslogtreecommitdiff
path: root/src/Network/Torrent
diff options
context:
space:
mode:
authorSam T <sta.cs.vsu@gmail.com>2013-04-17 12:13:58 +0400
committerSam T <sta.cs.vsu@gmail.com>2013-04-17 12:13:58 +0400
commit9e932d508dfd237e22f5a6dd6a351bae646c54e5 (patch)
treebd5c391e7eafd7b5839b38770c83f688901fffdf /src/Network/Torrent
parent62fe171daf84ea2090501535652e1c4ac9cc6d41 (diff)
~ Fix docs markup.
Diffstat (limited to 'src/Network/Torrent')
-rw-r--r--src/Network/Torrent/PeerID.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Network/Torrent/PeerID.hs b/src/Network/Torrent/PeerID.hs
index 3f41b99a..7071bc9b 100644
--- a/src/Network/Torrent/PeerID.hs
+++ b/src/Network/Torrent/PeerID.hs
@@ -4,19 +4,23 @@
4-- though this module exports some other goodies for custom generation. 4-- though this module exports some other goodies for custom generation.
5-- 5--
6module Network.Torrent.PeerID 6module Network.Torrent.PeerID
7 ( -- ^ Peer addr 7 ( -- * Peer addr
8 Peer(..) 8 Peer(..)
9 , peerSockAddr, connectToPeer 9 , peerSockAddr, connectToPeer
10 10
11 -- ^ Peer identification 11 -- * Peer identification
12 , PeerID (getPeerID) 12 , PeerID (getPeerID)
13 -- * Encoding styles 13
14 -- ** Encoding styles
14 , azureusStyle, shadowStyle 15 , azureusStyle, shadowStyle
15 -- * Defaults 16
17 -- ** Defaults
16 , defaultClientID, defaultVersionNumber 18 , defaultClientID, defaultVersionNumber
17 -- * Generation 19
20 -- ** Generation
18 , newPeerID, timestampByteString 21 , newPeerID, timestampByteString
19 -- * Extra 22 -- ** Extra
23
20 , byteStringPadded 24 , byteStringPadded
21 ) where 25 ) where
22 26
@@ -64,12 +68,12 @@ peerSockAddr = SockAddrInet <$> (g . peerPort) <*> (htonl . peerIP)
64 htonl :: Word32 -> Word32 68 htonl :: Word32 -> Word32
65 htonl d = 69 htonl d =
66 ((d .&. 0xff) `shiftL` 24) .|. 70 ((d .&. 0xff) `shiftL` 24) .|.
67 (((d `shiftR` 8 ) .&. 0xff) `shiftL` 16) .|. 71 (((d `shiftR` 8 ) .&. 0xff) `shiftL` 16) .|.
68 (((d `shiftR` 16) .&. 0xff) `shiftL` 8) .|. 72 (((d `shiftR` 16) .&. 0xff) `shiftL` 8) .|.
69 ((d `shiftR` 24) .&. 0xff) 73 ((d `shiftR` 24) .&. 0xff)
70 74
71 g :: PortNumber -> PortNumber 75 g :: PortNumber -> PortNumber
72 g (PortNum x) = PortNum x -- $ (x `shiftR` 8) .|. (x `shiftL` 8) 76 g = id
73 77
74-- ipv6 extension 78-- ipv6 extension
75-- | Tries to connect to peer using reasonable default parameters. 79-- | Tries to connect to peer using reasonable default parameters.