diff options
Diffstat (limited to 'src/Network/BitTorrent/Core/NodeInfo.hs')
-rw-r--r-- | src/Network/BitTorrent/Core/NodeInfo.hs | 9 |
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 | ||
41 | import Control.Applicative | 41 | import Control.Applicative |
42 | import Data.Aeson (ToJSON, FromJSON) | ||
43 | import Data.Aeson.TH | ||
44 | import Data.Bits | 42 | import Data.Bits |
45 | import Data.ByteString as BS | 43 | import Data.ByteString as BS |
46 | import Data.ByteString.Char8 as BC | 44 | import Data.ByteString.Char8 as BC |
@@ -62,7 +60,6 @@ import System.Entropy | |||
62 | import Text.PrettyPrint as PP hiding ((<>)) | 60 | import Text.PrettyPrint as PP hiding ((<>)) |
63 | import Text.PrettyPrint.Class | 61 | import Text.PrettyPrint.Class |
64 | 62 | ||
65 | import Data.Torrent.JSON | ||
66 | import Network.BitTorrent.Core.PeerAddr (PeerAddr (..)) | 63 | import 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. |
78 | newtype NodeId = NodeId ByteString | 75 | newtype NodeId = NodeId ByteString |
79 | deriving (Show, Eq, Ord, BEncode, FromJSON, ToJSON, Typeable) | 76 | deriving (Show, Eq, Ord, BEncode, Typeable) |
80 | 77 | ||
81 | nodeIdSize :: Int | 78 | nodeIdSize :: Int |
82 | nodeIdSize = 20 | 79 | nodeIdSize = 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 | |||
151 | instance Show a => Show (NodeAddr a) where | 146 | instance 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 | |||
207 | instance Eq a => Ord (NodeInfo a) where | 200 | instance Eq a => Ord (NodeInfo a) where |
208 | compare = comparing nodeId | 201 | compare = comparing nodeId |
209 | 202 | ||