From b3ebd83bda11e5fbf8e749fe4105e7a50522a9a7 Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Fri, 13 Dec 2013 06:19:18 +0400 Subject: Add Client.hs module --- src/Network/BitTorrent/Client.hs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Network/BitTorrent/Client.hs (limited to 'src') 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 @@ +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 -- cgit v1.2.3