diff options
author | joe <joe@jerkface.net> | 2017-06-04 22:39:14 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-06-04 22:39:14 -0400 |
commit | 219d72ebde4bab5a516a86608dcb3aede75c1611 (patch) | |
tree | df111d38c3532b9342f30c1bad98ef095569d54f /src/Network/BitTorrent/DHT/Token.hs | |
parent | 713cee07450697e40811e74059739da02dd604c7 (diff) |
WIP: Adapting DHT to Tox network.
Diffstat (limited to 'src/Network/BitTorrent/DHT/Token.hs')
-rw-r--r-- | src/Network/BitTorrent/DHT/Token.hs | 10 |
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 #-} |
21 | module Network.BitTorrent.DHT.Token | 21 | module 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 | ||
40 | import Control.Monad.State | 40 | import Control.Monad.State |
41 | #ifdef VERSION_bencoding | ||
41 | import Data.BEncode (BEncode) | 42 | import Data.BEncode (BEncode) |
43 | #endif | ||
42 | import Data.ByteString as BS | 44 | import Data.ByteString as BS |
43 | import Data.ByteString.Char8 as B8 | 45 | import Data.ByteString.Char8 as B8 |
44 | import Data.ByteString.Lazy as BL | 46 | import Data.ByteString.Lazy as BL |
@@ -57,7 +59,11 @@ import Network.BitTorrent.Address | |||
57 | 59 | ||
58 | -- | An opaque value. | 60 | -- | An opaque value. |
59 | newtype Token = Token BS.ByteString | 61 | newtype Token = Token BS.ByteString |
60 | deriving (Eq, BEncode, IsString) | 62 | deriving ( Eq, IsString |
63 | #ifdef VERSION_bencoding | ||
64 | , BEncode | ||
65 | #endif | ||
66 | ) | ||
61 | 67 | ||
62 | instance Show Token where | 68 | instance Show Token where |
63 | show (Token bs) = B8.unpack $ Base16.encode bs | 69 | show (Token bs) = B8.unpack $ Base16.encode bs |