diff options
Diffstat (limited to 'tests/Network/BitTorrent/Tracker/TestData.hs')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/TestData.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/Network/BitTorrent/Tracker/TestData.hs b/tests/Network/BitTorrent/Tracker/TestData.hs index 5d9718e5..85544b91 100644 --- a/tests/Network/BitTorrent/Tracker/TestData.hs +++ b/tests/Network/BitTorrent/Tracker/TestData.hs | |||
@@ -1,6 +1,9 @@ | |||
1 | {-# LANGUAGE RecordWildCards #-} | ||
1 | {-# OPTIONS_GHC -fno-warn-orphans #-} | 2 | {-# OPTIONS_GHC -fno-warn-orphans #-} |
2 | module Network.BitTorrent.Tracker.TestData | 3 | module Network.BitTorrent.Tracker.TestData |
3 | ( TrackerEntry (..) | 4 | ( TrackerEntry (..) |
5 | , isUdpTracker | ||
6 | , isHttpTracker | ||
4 | , trackers | 7 | , trackers |
5 | ) where | 8 | ) where |
6 | 9 | ||
@@ -29,6 +32,13 @@ data TrackerEntry = TrackerEntry | |||
29 | , hashList :: Maybe [InfoHash] | 32 | , hashList :: Maybe [InfoHash] |
30 | } | 33 | } |
31 | 34 | ||
35 | isUdpTracker :: TrackerEntry -> Bool | ||
36 | isUdpTracker TrackerEntry {..} = uriScheme trackerURI == "udp:" | ||
37 | |||
38 | isHttpTracker :: TrackerEntry -> Bool | ||
39 | isHttpTracker TrackerEntry {..} = uriScheme trackerURI == "http:" | ||
40 | || uriScheme trackerURI == "https:" | ||
41 | |||
32 | instance IsString URI where | 42 | instance IsString URI where |
33 | fromString str = fromMaybe err $ parseURI str | 43 | fromString str = fromMaybe err $ parseURI str |
34 | where | 44 | where |