From cb47bec6a3054a9190811e8305a8d748e5d2041c Mon Sep 17 00:00:00 2001 From: Sam T Date: Fri, 5 Apr 2013 02:52:22 +0400 Subject: add handshake serialization --- src/Network/Torrent/PeerID.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Network/Torrent/PeerID.hs') diff --git a/src/Network/Torrent/PeerID.hs b/src/Network/Torrent/PeerID.hs index ec87b470..5ca3ea42 100644 --- a/src/Network/Torrent/PeerID.hs +++ b/src/Network/Torrent/PeerID.hs @@ -23,19 +23,20 @@ import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Builder as B import Data.Foldable (foldMap) import Data.Monoid ((<>)) +import Data.Serialize (Serialize) import Data.Version (Version(Version), versionBranch) import Data.Time.Clock (getCurrentTime) import Data.Time.Format (formatTime) import System.Locale (defaultTimeLocale) -- TODO we have linker error here, so manual hardcoded version for a while. ---import Paths_network_bittorrent (version) +-- import Paths_network_bittorrent (version) version :: Version version = Version [0, 10, 0, 0] [] -- | Peer identifier is exactly 20 bytes long bytestring. newtype PeerID = PeerID { getPeerID :: ByteString } - deriving (Show, Eq, Ord, BEncodable) + deriving (Show, Eq, Ord, BEncodable, Serialize) -- | Azureus-style encoding: -- * 1 byte : '-' -- cgit v1.2.3