summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT/Token.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-06-04 22:39:14 -0400
committerjoe <joe@jerkface.net>2017-06-04 22:39:14 -0400
commit219d72ebde4bab5a516a86608dcb3aede75c1611 (patch)
treedf111d38c3532b9342f30c1bad98ef095569d54f /src/Network/BitTorrent/DHT/Token.hs
parent713cee07450697e40811e74059739da02dd604c7 (diff)
WIP: Adapting DHT to Tox network.
Diffstat (limited to 'src/Network/BitTorrent/DHT/Token.hs')
-rw-r--r--src/Network/BitTorrent/DHT/Token.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/DHT/Token.hs b/src/Network/BitTorrent/DHT/Token.hs
index 3f71aabe..4c930cbc 100644
--- a/src/Network/BitTorrent/DHT/Token.hs
+++ b/src/Network/BitTorrent/DHT/Token.hs
@@ -17,7 +17,7 @@
17-- must be accepted for a reasonable amount of time after they have 17-- must be accepted for a reasonable amount of time after they have
18-- been distributed. 18-- been distributed.
19-- 19--
20{-# LANGUAGE GeneralizedNewtypeDeriving #-} 20{-# LANGUAGE GeneralizedNewtypeDeriving, CPP #-}
21module Network.BitTorrent.DHT.Token 21module Network.BitTorrent.DHT.Token
22 ( -- * Token 22 ( -- * Token
23 Token 23 Token
@@ -38,7 +38,9 @@ module Network.BitTorrent.DHT.Token
38 ) where 38 ) where
39 39
40import Control.Monad.State 40import Control.Monad.State
41#ifdef VERSION_bencoding
41import Data.BEncode (BEncode) 42import Data.BEncode (BEncode)
43#endif
42import Data.ByteString as BS 44import Data.ByteString as BS
43import Data.ByteString.Char8 as B8 45import Data.ByteString.Char8 as B8
44import Data.ByteString.Lazy as BL 46import Data.ByteString.Lazy as BL
@@ -57,7 +59,11 @@ import Network.BitTorrent.Address
57 59
58-- | An opaque value. 60-- | An opaque value.
59newtype Token = Token BS.ByteString 61newtype Token = Token BS.ByteString
60 deriving (Eq, BEncode, IsString) 62 deriving ( Eq, IsString
63#ifdef VERSION_bencoding
64 , BEncode
65#endif
66 )
61 67
62instance Show Token where 68instance Show Token where
63 show (Token bs) = B8.unpack $ Base16.encode bs 69 show (Token bs) = B8.unpack $ Base16.encode bs