summaryrefslogtreecommitdiff
path: root/src/Network/Torrent/PeerID.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/Torrent/PeerID.hs')
-rw-r--r--src/Network/Torrent/PeerID.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Network/Torrent/PeerID.hs b/src/Network/Torrent/PeerID.hs
index d0687f59..6298cb87 100644
--- a/src/Network/Torrent/PeerID.hs
+++ b/src/Network/Torrent/PeerID.hs
@@ -4,7 +4,7 @@
4-- though this module exports some other goodies for custom generation. 4-- though this module exports some other goodies for custom generation.
5-- 5--
6module Network.Torrent.PeerID 6module Network.Torrent.PeerID
7 ( PeerID (getPeerID) 7 ( Peer(..), PeerID (getPeerID)
8 -- * Encoding styles 8 -- * Encoding styles
9 , azureusStyle, shadowStyle 9 , azureusStyle, shadowStyle
10 -- * Defaults 10 -- * Defaults
@@ -30,12 +30,21 @@ import Data.Version (Version(Version), versionBranch)
30import Data.Time.Clock (getCurrentTime) 30import Data.Time.Clock (getCurrentTime)
31import Data.Time.Format (formatTime) 31import Data.Time.Format (formatTime)
32import System.Locale (defaultTimeLocale) 32import System.Locale (defaultTimeLocale)
33import Network
34import Network.Socket
35
33 36
34-- TODO we have linker error here, so manual hardcoded version for a while. 37-- TODO we have linker error here, so manual hardcoded version for a while.
35-- import Paths_network_bittorrent (version) 38-- import Paths_network_bittorrent (version)
36version :: Version 39version :: Version
37version = Version [0, 10, 0, 0] [] 40version = Version [0, 10, 0, 0] []
38 41
42data Peer = Peer {
43 peerID :: Maybe PeerID
44 , peerIP :: HostAddress
45 , peerPort :: PortNumber
46 } deriving Show
47
39-- | Peer identifier is exactly 20 bytes long bytestring. 48-- | Peer identifier is exactly 20 bytes long bytestring.
40newtype PeerID = PeerID { getPeerID :: ByteString } 49newtype PeerID = PeerID { getPeerID :: ByteString }
41 deriving (Show, Eq, Ord, BEncodable) 50 deriving (Show, Eq, Ord, BEncodable)