diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-03-20 03:19:14 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-03-20 03:19:14 +0400 |
commit | 95f519df298c98d966c6408cac33cdd57b8e8a03 (patch) | |
tree | e6b0fb3ba6dafd6771cfc5084fcb3f7b1a7e26da /src/Network/BitTorrent/Core/PeerAddr.hs | |
parent | 17949276fbd32ab75bcb18016210b6947df54ed1 (diff) |
Add instance ToJSON TrackerEntry
Diffstat (limited to 'src/Network/BitTorrent/Core/PeerAddr.hs')
-rw-r--r-- | src/Network/BitTorrent/Core/PeerAddr.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Core/PeerAddr.hs b/src/Network/BitTorrent/Core/PeerAddr.hs index b62cb945..adf64c7f 100644 --- a/src/Network/BitTorrent/Core/PeerAddr.hs +++ b/src/Network/BitTorrent/Core/PeerAddr.hs | |||
@@ -34,6 +34,7 @@ module Network.BitTorrent.Core.PeerAddr | |||
34 | import Control.Applicative | 34 | import Control.Applicative |
35 | import Control.Monad | 35 | import Control.Monad |
36 | import Data.Aeson (ToJSON, FromJSON) | 36 | import Data.Aeson (ToJSON, FromJSON) |
37 | import Data.Aeson.TH | ||
37 | import Data.BEncode as BS | 38 | import Data.BEncode as BS |
38 | import Data.BEncode.BDict (BKey) | 39 | import Data.BEncode.BDict (BKey) |
39 | import Data.ByteString.Char8 as BS8 | 40 | import Data.ByteString.Char8 as BS8 |
@@ -57,6 +58,7 @@ import Text.Read (readMaybe) | |||
57 | import qualified Text.ParserCombinators.ReadP as RP | 58 | import qualified Text.ParserCombinators.ReadP as RP |
58 | 59 | ||
59 | import Data.Torrent.InfoHash | 60 | import Data.Torrent.InfoHash |
61 | import Data.Torrent.JSON | ||
60 | import Network.BitTorrent.Core.PeerId | 62 | import Network.BitTorrent.Core.PeerId |
61 | 63 | ||
62 | 64 | ||
@@ -206,6 +208,8 @@ data PeerAddr a = PeerAddr | |||
206 | , peerPort :: {-# UNPACK #-} !PortNumber | 208 | , peerPort :: {-# UNPACK #-} !PortNumber |
207 | } deriving (Show, Eq, Ord, Typeable, Functor) | 209 | } deriving (Show, Eq, Ord, Typeable, Functor) |
208 | 210 | ||
211 | $(deriveJSON omitRecordPrefix ''PeerAddr) | ||
212 | |||
209 | peer_ip_key, peer_id_key, peer_port_key :: BKey | 213 | peer_ip_key, peer_id_key, peer_port_key :: BKey |
210 | peer_ip_key = "ip" | 214 | peer_ip_key = "ip" |
211 | peer_id_key = "peer id" | 215 | peer_id_key = "peer id" |