summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam T <sta.cs.vsu@gmail.com>2013-04-21 00:01:22 +0400
committerSam T <sta.cs.vsu@gmail.com>2013-04-21 00:01:22 +0400
commit3c32f381afea629e06e8f069e0a3fefc72c8732e (patch)
tree194a4ade1cf7dd4d747e39397a8170a6b253f749
parent08bb327005c2f0dc517d0a74cf29e9f7f9b08e21 (diff)
~ Rename modules.
-rw-r--r--bench/serialization.hs2
-rw-r--r--network-bittorrent.cabal16
-rw-r--r--src/Network/BitTorrent.hs9
-rw-r--r--src/Network/BitTorrent/PeerID.hs (renamed from src/Network/Torrent/PeerID.hs)2
-rw-r--r--src/Network/BitTorrent/PeerWire.hs17
-rw-r--r--src/Network/BitTorrent/PeerWire/Block.hs (renamed from src/Network/Torrent/PeerWire/Block.hs)2
-rw-r--r--src/Network/BitTorrent/PeerWire/Handshake.hs (renamed from src/Network/Torrent/PeerWire/Handshake.hs)6
-rw-r--r--src/Network/BitTorrent/PeerWire/Message.hs (renamed from src/Network/Torrent/PeerWire/Message.hs)4
-rw-r--r--src/Network/BitTorrent/Tracker.hs (renamed from src/Network/Torrent/Tracker.hs)10
-rw-r--r--src/Network/BitTorrent/Tracker/Scrape.hs (renamed from src/Network/Torrent/Tracker/Scrape.hs)2
-rw-r--r--src/Network/Torrent.hs9
-rw-r--r--src/Network/Torrent/PeerWire.hs17
-rw-r--r--tests/encoding.hs6
13 files changed, 53 insertions, 49 deletions
diff --git a/bench/serialization.hs b/bench/serialization.hs
index e7770a1c..8ed90958 100644
--- a/bench/serialization.hs
+++ b/bench/serialization.hs
@@ -6,7 +6,7 @@ import Control.DeepSeq
6import Criterion.Main 6import Criterion.Main
7import Data.ByteString (ByteString) 7import Data.ByteString (ByteString)
8import Data.Serialize 8import Data.Serialize
9import Network.Torrent 9import Network.BitTorrent
10 10
11 11
12instance NFData BlockIx where 12instance NFData BlockIx where
diff --git a/network-bittorrent.cabal b/network-bittorrent.cabal
index 6fa115e6..5cd46216 100644
--- a/network-bittorrent.cabal
+++ b/network-bittorrent.cabal
@@ -23,14 +23,14 @@ source-repository head
23library 23library
24 exposed-modules: Data.Torrent 24 exposed-modules: Data.Torrent
25 , Data.Torrent.InfoHash 25 , Data.Torrent.InfoHash
26 , Network.Torrent 26 , Network.BitTorrent
27 , Network.Torrent.PeerID 27 , Network.BitTorrent.PeerID
28 , Network.Torrent.Tracker 28 , Network.BitTorrent.Tracker
29 , Network.Torrent.Tracker.Scrape 29 , Network.BitTorrent.Tracker.Scrape
30 , Network.Torrent.PeerWire 30 , Network.BitTorrent.PeerWire
31 , Network.Torrent.PeerWire.Block 31 , Network.BitTorrent.PeerWire.Block
32 , Network.Torrent.PeerWire.Message 32 , Network.BitTorrent.PeerWire.Message
33 , Network.Torrent.PeerWire.Handshake 33 , Network.BitTorrent.PeerWire.Handshake
34 34
35 other-modules: 35 other-modules:
36 36
diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs
new file mode 100644
index 00000000..9c1977d4
--- /dev/null
+++ b/src/Network/BitTorrent.hs
@@ -0,0 +1,9 @@
1module Network.BitTorrent
2 ( module Network.BitTorrent.PeerID
3 , module Network.BitTorrent.Tracker
4 , module Network.BitTorrent.PeerWire
5 ) where
6
7import Network.BitTorrent.PeerID
8import Network.BitTorrent.Tracker
9import Network.BitTorrent.PeerWire
diff --git a/src/Network/Torrent/PeerID.hs b/src/Network/BitTorrent/PeerID.hs
index 7d928f80..cef1fa58 100644
--- a/src/Network/Torrent/PeerID.hs
+++ b/src/Network/BitTorrent/PeerID.hs
@@ -12,7 +12,7 @@
12-- though this module exports some other goodies for custom generation. 12-- though this module exports some other goodies for custom generation.
13-- 13--
14{-# LANGUAGE OverloadedStrings, GeneralizedNewtypeDeriving #-} 14{-# LANGUAGE OverloadedStrings, GeneralizedNewtypeDeriving #-}
15module Network.Torrent.PeerID 15module Network.BitTorrent.PeerID
16 ( -- * Peer addr 16 ( -- * Peer addr
17 Peer(..) 17 Peer(..)
18 , peerSockAddr, connectToPeer 18 , peerSockAddr, connectToPeer
diff --git a/src/Network/BitTorrent/PeerWire.hs b/src/Network/BitTorrent/PeerWire.hs
new file mode 100644
index 00000000..768da5f2
--- /dev/null
+++ b/src/Network/BitTorrent/PeerWire.hs
@@ -0,0 +1,17 @@
1-- |
2-- Copyright : (c) Sam T. 2013
3-- License : MIT
4-- Maintainer : pxqr.sta@gmail.com
5-- Stability : experimental
6-- Portability : portable
7--
8{-# LANGUAGE DoAndIfThenElse #-}
9module Network.BitTorrent.PeerWire
10 ( module Network.BitTorrent.PeerWire.Block
11 , module Network.BitTorrent.PeerWire.Message
12 , module Network.BitTorrent.PeerWire.Handshake
13 ) where
14
15import Network.BitTorrent.PeerWire.Block
16import Network.BitTorrent.PeerWire.Message
17import Network.BitTorrent.PeerWire.Handshake
diff --git a/src/Network/Torrent/PeerWire/Block.hs b/src/Network/BitTorrent/PeerWire/Block.hs
index 056f6b18..33e3dead 100644
--- a/src/Network/Torrent/PeerWire/Block.hs
+++ b/src/Network/BitTorrent/PeerWire/Block.hs
@@ -1,4 +1,4 @@
1module Network.Torrent.PeerWire.Block 1module Network.BitTorrent.PeerWire.Block
2 ( BlockIx(..), Block(..) 2 ( BlockIx(..), Block(..)
3 , defaultBlockSize 3 , defaultBlockSize
4 , blockRange, ixRange, pieceIx 4 , blockRange, ixRange, pieceIx
diff --git a/src/Network/Torrent/PeerWire/Handshake.hs b/src/Network/BitTorrent/PeerWire/Handshake.hs
index 733d5785..6ce37887 100644
--- a/src/Network/Torrent/PeerWire/Handshake.hs
+++ b/src/Network/BitTorrent/PeerWire/Handshake.hs
@@ -6,7 +6,7 @@
6-- Portability : portable 6-- Portability : portable
7-- 7--
8{-# LANGUAGE OverloadedStrings #-} 8{-# LANGUAGE OverloadedStrings #-}
9module Network.Torrent.PeerWire.Handshake 9module Network.BitTorrent.PeerWire.Handshake
10 ( Handshake 10 ( Handshake
11 , handshakeMaxSize 11 , handshakeMaxSize
12 , defaultBTProtocol, defaultReserved, defaultHandshake 12 , defaultBTProtocol, defaultReserved, defaultHandshake
@@ -21,7 +21,9 @@ import Data.Serialize as S
21import Data.Torrent.InfoHash 21import Data.Torrent.InfoHash
22import Network 22import Network
23import Network.Socket.ByteString 23import Network.Socket.ByteString
24import Network.Torrent.PeerID 24
25import Network.BitTorrent.PeerID
26
25 27
26-- | In order to establish the connection between peers we should send 'Handshake' 28-- | In order to establish the connection between peers we should send 'Handshake'
27-- message. The 'Handshake' is a required message and must be the first message 29-- message. The 'Handshake' is a required message and must be the first message
diff --git a/src/Network/Torrent/PeerWire/Message.hs b/src/Network/BitTorrent/PeerWire/Message.hs
index e04038ff..1bcb2ee5 100644
--- a/src/Network/Torrent/PeerWire/Message.hs
+++ b/src/Network/BitTorrent/PeerWire/Message.hs
@@ -1,4 +1,4 @@
1module Network.Torrent.PeerWire.Message 1module Network.BitTorrent.PeerWire.Message
2 ( Message(..) 2 ( Message(..)
3 ) where 3 ) where
4 4
@@ -8,7 +8,7 @@ import qualified Data.ByteString as B
8 8
9import Data.Serialize 9import Data.Serialize
10 10
11import Network.Torrent.PeerWire.Block 11import Network.BitTorrent.PeerWire.Block
12 12
13 13
14-- TODO comment message constructors 14-- TODO comment message constructors
diff --git a/src/Network/Torrent/Tracker.hs b/src/Network/BitTorrent/Tracker.hs
index ffbdc949..3cafbe1d 100644
--- a/src/Network/Torrent/Tracker.hs
+++ b/src/Network/BitTorrent/Tracker.hs
@@ -8,8 +8,8 @@
8-- 8--
9{-# OPTIONS -fno-warn-orphans #-} 9{-# OPTIONS -fno-warn-orphans #-}
10{-# LANGUAGE OverloadedStrings #-} 10{-# LANGUAGE OverloadedStrings #-}
11module Network.Torrent.Tracker 11module Network.BitTorrent.Tracker
12 ( module Network.Torrent.Tracker.Scrape 12 ( module Network.BitTorrent.Tracker.Scrape
13 13
14 -- * Requests 14 -- * Requests
15 , Event(..), TRequest(..) 15 , Event(..), TRequest(..)
@@ -24,8 +24,6 @@ module Network.Torrent.Tracker
24 ) 24 )
25 where 25 where
26 26
27import Network.Torrent.Tracker.Scrape
28
29import Control.Applicative 27import Control.Applicative
30import Data.Char as Char 28import Data.Char as Char
31import Data.Word (Word32) 29import Data.Word (Word32)
@@ -44,7 +42,9 @@ import Network
44import Network.Socket 42import Network.Socket
45import Network.HTTP 43import Network.HTTP
46import Network.URI 44import Network.URI
47import Network.Torrent.PeerID 45
46import Network.BitTorrent.PeerID
47import Network.BitTorrent.Tracker.Scrape
48 48
49 49
50data Event = Started -- ^ For first request. 50data Event = Started -- ^ For first request.
diff --git a/src/Network/Torrent/Tracker/Scrape.hs b/src/Network/BitTorrent/Tracker/Scrape.hs
index f5ebbea4..49451a57 100644
--- a/src/Network/Torrent/Tracker/Scrape.hs
+++ b/src/Network/BitTorrent/Tracker/Scrape.hs
@@ -11,7 +11,7 @@
11-- scrape info for a particular torrent list. 11-- scrape info for a particular torrent list.
12-- 12--
13{-# LANGUAGE OverloadedStrings #-} 13{-# LANGUAGE OverloadedStrings #-}
14module Network.Torrent.Tracker.Scrape 14module Network.BitTorrent.Tracker.Scrape
15 ( ScrapeInfo(..), Scrape 15 ( ScrapeInfo(..), Scrape
16 , scrapeURL 16 , scrapeURL
17 17
diff --git a/src/Network/Torrent.hs b/src/Network/Torrent.hs
deleted file mode 100644
index a37bee41..00000000
--- a/src/Network/Torrent.hs
+++ /dev/null
@@ -1,9 +0,0 @@
1module Network.Torrent
2 ( module Network.Torrent.PeerID
3 , module Network.Torrent.Tracker
4 , module Network.Torrent.PeerWire
5 ) where
6
7import Network.Torrent.PeerID
8import Network.Torrent.Tracker
9import Network.Torrent.PeerWire
diff --git a/src/Network/Torrent/PeerWire.hs b/src/Network/Torrent/PeerWire.hs
deleted file mode 100644
index 887e56d5..00000000
--- a/src/Network/Torrent/PeerWire.hs
+++ /dev/null
@@ -1,17 +0,0 @@
1-- |
2-- Copyright : (c) Sam T. 2013
3-- License : MIT
4-- Maintainer : pxqr.sta@gmail.com
5-- Stability : experimental
6-- Portability : portable
7--
8{-# LANGUAGE DoAndIfThenElse #-}
9module Network.Torrent.PeerWire
10 ( module Network.Torrent.PeerWire.Block
11 , module Network.Torrent.PeerWire.Message
12 , module Network.Torrent.PeerWire.Handshake
13 ) where
14
15import Network.Torrent.PeerWire.Block
16import Network.Torrent.PeerWire.Message
17import Network.Torrent.PeerWire.Handshake
diff --git a/tests/encoding.hs b/tests/encoding.hs
index bacf275e..a8490551 100644
--- a/tests/encoding.hs
+++ b/tests/encoding.hs
@@ -11,10 +11,12 @@ import Test.Framework (defaultMain, Test)
11import Test.Framework.Providers.QuickCheck2 (testProperty) 11import Test.Framework.Providers.QuickCheck2 (testProperty)
12import Test.QuickCheck 12import Test.QuickCheck
13 13
14import Data.Torrent
15import Network.Torrent
16import Network.URI 14import Network.URI
17 15
16import Data.Torrent
17import Network.BitTorrent
18
19
18positive :: Gen Int 20positive :: Gen Int
19positive = fromIntegral <$> (arbitrary :: Gen Word32) 21positive = fromIntegral <$> (arbitrary :: Gen Word32)
20 22