summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r--src/Network/BitTorrent/Tracker.hs6
-rw-r--r--src/Network/BitTorrent/Tracker/Session.hs40
2 files changed, 38 insertions, 8 deletions
diff --git a/src/Network/BitTorrent/Tracker.hs b/src/Network/BitTorrent/Tracker.hs
index 6af76a16..f43b5dc2 100644
--- a/src/Network/BitTorrent/Tracker.hs
+++ b/src/Network/BitTorrent/Tracker.hs
@@ -11,9 +11,8 @@
11-- 11--
12{-# LANGUAGE TemplateHaskell #-} 12{-# LANGUAGE TemplateHaskell #-}
13module Network.BitTorrent.Tracker 13module Network.BitTorrent.Tracker
14 ( PeerInfo (..) 14 ( -- * RPC Manager
15 15 PeerInfo (..)
16 -- * RPC Manager
17 , Options 16 , Options
18 , Manager 17 , Manager
19 , newManager 18 , newManager
@@ -35,6 +34,7 @@ module Network.BitTorrent.Tracker
35-- , getSessionState 34-- , getSessionState
36 ) where 35 ) where
37 36
37import Network.BitTorrent.Tracker.Message
38import Network.BitTorrent.Tracker.List 38import Network.BitTorrent.Tracker.List
39import Network.BitTorrent.Tracker.RPC 39import Network.BitTorrent.Tracker.RPC
40import Network.BitTorrent.Tracker.Session 40import Network.BitTorrent.Tracker.Session
diff --git a/src/Network/BitTorrent/Tracker/Session.hs b/src/Network/BitTorrent/Tracker/Session.hs
index 295f9322..9b7654dd 100644
--- a/src/Network/BitTorrent/Tracker/Session.hs
+++ b/src/Network/BitTorrent/Tracker/Session.hs
@@ -13,12 +13,16 @@ module Network.BitTorrent.Tracker.Session
13 , newSession 13 , newSession
14 , closeSession 14 , closeSession
15 15
16 -- * Events 16 -- * Trackers
17 , Event (..)
18 , notify 17 , notify
19
20 -- * Query
21 , askPeers 18 , askPeers
19
20 -- * Tracker Exchange
21 -- | BEP28: <http://www.bittorrent.org/beps/bep_0028.html>
22 , addTracker
23 , removeTracker
24 , getTrackers
25 , getTrustedTrackers
22 ) where 26 ) where
23 27
24import Control.Applicative 28import Control.Applicative
@@ -194,6 +198,32 @@ data TrackerInfo = TrackerInfo
194--instance ToJSON TrackerInfo where 198--instance ToJSON TrackerInfo where
195-- toJSON = undefined 199-- toJSON = undefined
196 200
197-- |
198--getSessionState :: Session -> IO (TrackerList TrackerInfo) 201--getSessionState :: Session -> IO (TrackerList TrackerInfo)
199--getSessionState = undefined 202--getSessionState = undefined
203
204{-----------------------------------------------------------------------
205-- Tracker exchange
206-----------------------------------------------------------------------}
207
208-- Trackers discovered through this protocol SHOULD be treated with a
209-- certain amount of suspicion. Since the source of a tracker exchange
210-- message cannot be trusted, an implementation SHOULD have a lower
211-- number of retries before giving up entirely.
212
213addTracker :: Session -> URI -> IO ()
214addTracker = undefined
215
216removeTracker :: Session -> URI -> IO ()
217removeTracker = undefined
218
219-- Also, as specified under the definitions section, a tracker that
220-- has not worked should never be propagated to other peers over the
221-- tracker exchange protocol.
222
223-- | Return all known trackers.
224getTrackers :: Session -> IO [URI]
225getTrackers = undefined
226
227-- | Return trackers from torrent file and
228getTrustedTrackers :: Session -> IO [URI]
229getTrustedTrackers = undefined