summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/Torrent/PeerWire/Handshake.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Network/Torrent/PeerWire/Handshake.hs b/src/Network/Torrent/PeerWire/Handshake.hs
index ab255c14..ae65933f 100644
--- a/src/Network/Torrent/PeerWire/Handshake.hs
+++ b/src/Network/Torrent/PeerWire/Handshake.hs
@@ -1,6 +1,7 @@
1{-# LANGUAGE OverloadedStrings #-} 1{-# LANGUAGE OverloadedStrings #-}
2module Network.Torrent.PeerWire.Handshake 2module Network.Torrent.PeerWire.Handshake
3 ( Handshake 3 ( Handshake
4 , handshakeMaxSize
4 , defaultProtocol, defaultReserved, defaultHandshake 5 , defaultProtocol, defaultReserved, defaultHandshake
5 ) where 6 ) where
6 7
@@ -39,6 +40,10 @@ instance Serialize Handshake where
39 <*> get 40 <*> get
40 <*> get 41 <*> get
41 42
43-- | Maximum size of handshake message in bytes.
44handshakeMaxSize :: Int
45handshakeMaxSize = 1 + 256 + 8 + 20 + 20
46
42-- | Default protocol string "BitTorrent protocol" as is. 47-- | Default protocol string "BitTorrent protocol" as is.
43defaultProtocol :: ByteString 48defaultProtocol :: ByteString
44defaultProtocol = "BitTorrent protocol" 49defaultProtocol = "BitTorrent protocol"
@@ -49,4 +54,4 @@ defaultReserved = 0
49 54
50-- | Length of info hash and peer id is unchecked, so it /should/ be equal 20. 55-- | Length of info hash and peer id is unchecked, so it /should/ be equal 20.
51defaultHandshake :: InfoHash -> PeerID -> Handshake 56defaultHandshake :: InfoHash -> PeerID -> Handshake
52defaultHandshake hash pid = Handshake defaultProtocol defaultReserved hash pid \ No newline at end of file 57defaultHandshake = Handshake defaultProtocol defaultReserved \ No newline at end of file