summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Data/Torrent.hs12
-rw-r--r--tests/Data/Torrent/MetainfoSpec.hs2
2 files changed, 12 insertions, 2 deletions
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index 05d3c86c..db7f38eb 100644
--- a/src/Data/Torrent.hs
+++ b/src/Data/Torrent.hs
@@ -94,7 +94,7 @@ import Data.Torrent.InfoHash as IH
94import Data.Torrent.JSON 94import Data.Torrent.JSON
95import Data.Torrent.Layout 95import Data.Torrent.Layout
96import Data.Torrent.Piece 96import Data.Torrent.Piece
97 97import Network.BitTorrent.Core.Node
98 98
99{----------------------------------------------------------------------- 99{-----------------------------------------------------------------------
100-- Info dictionary 100-- Info dictionary
@@ -215,6 +215,12 @@ data Torrent = Torrent
215 , tInfoDict :: !InfoDict 215 , tInfoDict :: !InfoDict
216 -- ^ Info about each content file. 216 -- ^ Info about each content file.
217 217
218 , tNodes :: Maybe [NodeAddr ByteString]
219 -- ^ This key should be set to the /K closest/ nodes in the
220 -- torrent generating client's routing table. Alternatively, the
221 -- key could be set to a known good 'Network.BitTorrent.Core.Node'
222 -- such as one operated by the person generating the torrent.
223
218 , tPublisher :: !(Maybe URI) 224 , tPublisher :: !(Maybe URI)
219 -- ^ Containing the RSA public key of the publisher of the 225 -- ^ Containing the RSA public key of the publisher of the
220 -- torrent. Private counterpart of this key that has the 226 -- torrent. Private counterpart of this key that has the
@@ -285,6 +291,7 @@ instance BEncode Torrent where
285 .: "creation date" .=? tCreationDate 291 .: "creation date" .=? tCreationDate
286 .: "encoding" .=? tEncoding 292 .: "encoding" .=? tEncoding
287 .: "info" .=! tInfoDict 293 .: "info" .=! tInfoDict
294 .: "nodes" .=? tNodes
288 .: "publisher" .=? tPublisher 295 .: "publisher" .=? tPublisher
289 .: "publisher-url" .=? tPublisherURL 296 .: "publisher-url" .=? tPublisherURL
290 .: "signature" .=? tSignature 297 .: "signature" .=? tSignature
@@ -298,6 +305,7 @@ instance BEncode Torrent where
298 <*>? "creation date" 305 <*>? "creation date"
299 <*>? "encoding" 306 <*>? "encoding"
300 <*>! "info" 307 <*>! "info"
308 <*>? "nodes"
301 <*>? "publisher" 309 <*>? "publisher"
302 <*>? "publisher-url" 310 <*>? "publisher-url"
303 <*>? "signature" 311 <*>? "signature"
@@ -336,7 +344,7 @@ instance Pretty Torrent where
336nullTorrent :: URI -> InfoDict -> Torrent 344nullTorrent :: URI -> InfoDict -> Torrent
337nullTorrent ann info = Torrent 345nullTorrent ann info = Torrent
338 ann Nothing Nothing Nothing Nothing Nothing 346 ann Nothing Nothing Nothing Nothing Nothing
339 info Nothing Nothing Nothing 347 info Nothing Nothing Nothing Nothing
340 348
341-- | Mime type of torrent files. 349-- | Mime type of torrent files.
342typeTorrent :: BS.ByteString 350typeTorrent :: BS.ByteString
diff --git a/tests/Data/Torrent/MetainfoSpec.hs b/tests/Data/Torrent/MetainfoSpec.hs
index b5716e07..d2e0e52e 100644
--- a/tests/Data/Torrent/MetainfoSpec.hs
+++ b/tests/Data/Torrent/MetainfoSpec.hs
@@ -17,6 +17,7 @@ import Data.Torrent.Piece
17import Data.Torrent.Layout 17import Data.Torrent.Layout
18import Data.Torrent 18import Data.Torrent
19import Data.Torrent.LayoutSpec () 19import Data.Torrent.LayoutSpec ()
20import Network.BitTorrent.Core.NodeSpec ()
20 21
21{----------------------------------------------------------------------- 22{-----------------------------------------------------------------------
22-- Common 23-- Common
@@ -57,6 +58,7 @@ instance Arbitrary Torrent where
57 arbitrary = Torrent <$> arbitrary 58 arbitrary = Torrent <$> arbitrary
58 <*> arbitrary <*> arbitrary <*> arbitrary 59 <*> arbitrary <*> arbitrary <*> arbitrary
59 <*> pico <*> arbitrary <*> arbitrary 60 <*> pico <*> arbitrary <*> arbitrary
61 <*> arbitrary
60 <*> arbitrary <*> pure Nothing <*> arbitrary 62 <*> arbitrary <*> pure Nothing <*> arbitrary
61 63
62{----------------------------------------------------------------------- 64{-----------------------------------------------------------------------