summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Client.hs
blob: fc2b904a1834e86c25b76286bba61c4ab8749589 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module Network.BitTorrent.Client
       ( Options (..)
       , Client (..)
       ) where

import Data.Default
import Data.Function
import Data.Ord
import Data.Text
import Network

import Data.Torrent
import Data.Torrent.InfoHash
import Network.BitTorrent.Core
import Network.BitTorrent.Exchange.Message


data Options = Options
  { fingerprint :: Fingerprint
  , name        :: Text
  , port        :: PortNumber
  }

instance Default Options where
  def = Options
    { fingerprint = def
    , name        = "hs-bittorrent"
    , port        = 6882
    }

data Client = Client
  { clientPeerId      :: !PeerId
  , allowedExtensions :: !Caps
  }

instance Eq Client where
  (==) = (==) `on` clientPeerId

instance Ord Client where
  compare = comparing clientPeerId