diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/BitTorrent/Client.hs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Client.hs b/src/Network/BitTorrent/Client.hs new file mode 100644 index 00000000..fc2b904a --- /dev/null +++ b/src/Network/BitTorrent/Client.hs | |||
@@ -0,0 +1,40 @@ | |||
1 | module Network.BitTorrent.Client | ||
2 | ( Options (..) | ||
3 | , Client (..) | ||
4 | ) where | ||
5 | |||
6 | import Data.Default | ||
7 | import Data.Function | ||
8 | import Data.Ord | ||
9 | import Data.Text | ||
10 | import Network | ||
11 | |||
12 | import Data.Torrent | ||
13 | import Data.Torrent.InfoHash | ||
14 | import Network.BitTorrent.Core | ||
15 | import Network.BitTorrent.Exchange.Message | ||
16 | |||
17 | |||
18 | data Options = Options | ||
19 | { fingerprint :: Fingerprint | ||
20 | , name :: Text | ||
21 | , port :: PortNumber | ||
22 | } | ||
23 | |||
24 | instance Default Options where | ||
25 | def = Options | ||
26 | { fingerprint = def | ||
27 | , name = "hs-bittorrent" | ||
28 | , port = 6882 | ||
29 | } | ||
30 | |||
31 | data Client = Client | ||
32 | { clientPeerId :: !PeerId | ||
33 | , allowedExtensions :: !Caps | ||
34 | } | ||
35 | |||
36 | instance Eq Client where | ||
37 | (==) = (==) `on` clientPeerId | ||
38 | |||
39 | instance Ord Client where | ||
40 | compare = comparing clientPeerId | ||