summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Core/NodeInfo.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Core/NodeInfo.hs')
-rw-r--r--src/Network/BitTorrent/Core/NodeInfo.hs9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/Network/BitTorrent/Core/NodeInfo.hs b/src/Network/BitTorrent/Core/NodeInfo.hs
index fa20caf5..fe17c097 100644
--- a/src/Network/BitTorrent/Core/NodeInfo.hs
+++ b/src/Network/BitTorrent/Core/NodeInfo.hs
@@ -39,8 +39,6 @@ module Network.BitTorrent.Core.NodeInfo
39 ) where 39 ) where
40 40
41import Control.Applicative 41import Control.Applicative
42import Data.Aeson (ToJSON, FromJSON)
43import Data.Aeson.TH
44import Data.Bits 42import Data.Bits
45import Data.ByteString as BS 43import Data.ByteString as BS
46import Data.ByteString.Char8 as BC 44import Data.ByteString.Char8 as BC
@@ -62,7 +60,6 @@ import System.Entropy
62import Text.PrettyPrint as PP hiding ((<>)) 60import Text.PrettyPrint as PP hiding ((<>))
63import Text.PrettyPrint.Class 61import Text.PrettyPrint.Class
64 62
65import Data.Torrent.JSON
66import Network.BitTorrent.Core.PeerAddr (PeerAddr (..)) 63import Network.BitTorrent.Core.PeerAddr (PeerAddr (..))
67 64
68{----------------------------------------------------------------------- 65{-----------------------------------------------------------------------
@@ -76,7 +73,7 @@ import Network.BitTorrent.Core.PeerAddr (PeerAddr (..))
76-- Normally, /this/ node id should be saved between invocations 73-- Normally, /this/ node id should be saved between invocations
77-- of the client software. 74-- of the client software.
78newtype NodeId = NodeId ByteString 75newtype NodeId = NodeId ByteString
79 deriving (Show, Eq, Ord, BEncode, FromJSON, ToJSON, Typeable) 76 deriving (Show, Eq, Ord, BEncode, Typeable)
80 77
81nodeIdSize :: Int 78nodeIdSize :: Int
82nodeIdSize = 20 79nodeIdSize = 20
@@ -146,8 +143,6 @@ data NodeAddr a = NodeAddr
146 , nodePort :: {-# UNPACK #-} !PortNumber 143 , nodePort :: {-# UNPACK #-} !PortNumber
147 } deriving (Eq, Typeable, Functor) 144 } deriving (Eq, Typeable, Functor)
148 145
149$(deriveJSON omitRecordPrefix ''NodeAddr)
150
151instance Show a => Show (NodeAddr a) where 146instance Show a => Show (NodeAddr a) where
152 showsPrec i NodeAddr {..} 147 showsPrec i NodeAddr {..}
153 = showsPrec i nodeHost <> showString ":" <> showsPrec i nodePort 148 = showsPrec i nodeHost <> showString ":" <> showsPrec i nodePort
@@ -202,8 +197,6 @@ data NodeInfo a = NodeInfo
202 , nodeAddr :: !(NodeAddr a) 197 , nodeAddr :: !(NodeAddr a)
203 } deriving (Show, Eq, Functor) 198 } deriving (Show, Eq, Functor)
204 199
205$(deriveJSON omitRecordPrefix ''NodeInfo)
206
207instance Eq a => Ord (NodeInfo a) where 200instance Eq a => Ord (NodeInfo a) where
208 compare = comparing nodeId 201 compare = comparing nodeId
209 202