diff options
author | Sam T <sta.cs.vsu@gmail.com> | 2013-04-21 00:01:22 +0400 |
---|---|---|
committer | Sam T <sta.cs.vsu@gmail.com> | 2013-04-21 00:01:22 +0400 |
commit | 3c32f381afea629e06e8f069e0a3fefc72c8732e (patch) | |
tree | 194a4ade1cf7dd4d747e39397a8170a6b253f749 | |
parent | 08bb327005c2f0dc517d0a74cf29e9f7f9b08e21 (diff) |
~ Rename modules.
-rw-r--r-- | bench/serialization.hs | 2 | ||||
-rw-r--r-- | network-bittorrent.cabal | 16 | ||||
-rw-r--r-- | src/Network/BitTorrent.hs | 9 | ||||
-rw-r--r-- | src/Network/BitTorrent/PeerID.hs (renamed from src/Network/Torrent/PeerID.hs) | 2 | ||||
-rw-r--r-- | src/Network/BitTorrent/PeerWire.hs | 17 | ||||
-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.hs | 9 | ||||
-rw-r--r-- | src/Network/Torrent/PeerWire.hs | 17 | ||||
-rw-r--r-- | tests/encoding.hs | 6 |
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 | |||
6 | import Criterion.Main | 6 | import Criterion.Main |
7 | import Data.ByteString (ByteString) | 7 | import Data.ByteString (ByteString) |
8 | import Data.Serialize | 8 | import Data.Serialize |
9 | import Network.Torrent | 9 | import Network.BitTorrent |
10 | 10 | ||
11 | 11 | ||
12 | instance NFData BlockIx where | 12 | instance 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 | |||
23 | library | 23 | library |
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 @@ | |||
1 | module Network.BitTorrent | ||
2 | ( module Network.BitTorrent.PeerID | ||
3 | , module Network.BitTorrent.Tracker | ||
4 | , module Network.BitTorrent.PeerWire | ||
5 | ) where | ||
6 | |||
7 | import Network.BitTorrent.PeerID | ||
8 | import Network.BitTorrent.Tracker | ||
9 | import 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 #-} |
15 | module Network.Torrent.PeerID | 15 | module 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 #-} | ||
9 | module Network.BitTorrent.PeerWire | ||
10 | ( module Network.BitTorrent.PeerWire.Block | ||
11 | , module Network.BitTorrent.PeerWire.Message | ||
12 | , module Network.BitTorrent.PeerWire.Handshake | ||
13 | ) where | ||
14 | |||
15 | import Network.BitTorrent.PeerWire.Block | ||
16 | import Network.BitTorrent.PeerWire.Message | ||
17 | import 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 @@ | |||
1 | module Network.Torrent.PeerWire.Block | 1 | module 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 #-} |
9 | module Network.Torrent.PeerWire.Handshake | 9 | module 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 | |||
21 | import Data.Torrent.InfoHash | 21 | import Data.Torrent.InfoHash |
22 | import Network | 22 | import Network |
23 | import Network.Socket.ByteString | 23 | import Network.Socket.ByteString |
24 | import Network.Torrent.PeerID | 24 | |
25 | import 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 @@ | |||
1 | module Network.Torrent.PeerWire.Message | 1 | module 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 | ||
9 | import Data.Serialize | 9 | import Data.Serialize |
10 | 10 | ||
11 | import Network.Torrent.PeerWire.Block | 11 | import 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 #-} |
11 | module Network.Torrent.Tracker | 11 | module 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 | ||
27 | import Network.Torrent.Tracker.Scrape | ||
28 | |||
29 | import Control.Applicative | 27 | import Control.Applicative |
30 | import Data.Char as Char | 28 | import Data.Char as Char |
31 | import Data.Word (Word32) | 29 | import Data.Word (Word32) |
@@ -44,7 +42,9 @@ import Network | |||
44 | import Network.Socket | 42 | import Network.Socket |
45 | import Network.HTTP | 43 | import Network.HTTP |
46 | import Network.URI | 44 | import Network.URI |
47 | import Network.Torrent.PeerID | 45 | |
46 | import Network.BitTorrent.PeerID | ||
47 | import Network.BitTorrent.Tracker.Scrape | ||
48 | 48 | ||
49 | 49 | ||
50 | data Event = Started -- ^ For first request. | 50 | data 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 #-} |
14 | module Network.Torrent.Tracker.Scrape | 14 | module 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 @@ | |||
1 | module Network.Torrent | ||
2 | ( module Network.Torrent.PeerID | ||
3 | , module Network.Torrent.Tracker | ||
4 | , module Network.Torrent.PeerWire | ||
5 | ) where | ||
6 | |||
7 | import Network.Torrent.PeerID | ||
8 | import Network.Torrent.Tracker | ||
9 | import 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 #-} | ||
9 | module Network.Torrent.PeerWire | ||
10 | ( module Network.Torrent.PeerWire.Block | ||
11 | , module Network.Torrent.PeerWire.Message | ||
12 | , module Network.Torrent.PeerWire.Handshake | ||
13 | ) where | ||
14 | |||
15 | import Network.Torrent.PeerWire.Block | ||
16 | import Network.Torrent.PeerWire.Message | ||
17 | import 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) | |||
11 | import Test.Framework.Providers.QuickCheck2 (testProperty) | 11 | import Test.Framework.Providers.QuickCheck2 (testProperty) |
12 | import Test.QuickCheck | 12 | import Test.QuickCheck |
13 | 13 | ||
14 | import Data.Torrent | ||
15 | import Network.Torrent | ||
16 | import Network.URI | 14 | import Network.URI |
17 | 15 | ||
16 | import Data.Torrent | ||
17 | import Network.BitTorrent | ||
18 | |||
19 | |||
18 | positive :: Gen Int | 20 | positive :: Gen Int |
19 | positive = fromIntegral <$> (arbitrary :: Gen Word32) | 21 | positive = fromIntegral <$> (arbitrary :: Gen Word32) |
20 | 22 | ||