summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r--src/Network/BitTorrent/Core/PeerId.hs4
-rw-r--r--src/Network/BitTorrent/Tracker/RPC.hs5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/Core/PeerId.hs b/src/Network/BitTorrent/Core/PeerId.hs
index cab30331..c860d9d4 100644
--- a/src/Network/BitTorrent/Core/PeerId.hs
+++ b/src/Network/BitTorrent/Core/PeerId.hs
@@ -73,6 +73,10 @@ newtype PeerId = PeerId { getPeerId :: ByteString }
73peerIdLen :: Int 73peerIdLen :: Int
74peerIdLen = 20 74peerIdLen = 20
75 75
76-- | For testing purposes only.
77instance Default PeerId where
78 def = azureusStyle defaultClientId defaultVersionNumber ""
79
76instance Hashable PeerId where 80instance Hashable PeerId where
77 hashWithSalt = hashUsing getPeerId 81 hashWithSalt = hashUsing getPeerId
78 {-# INLINE hashWithSalt #-} 82 {-# INLINE hashWithSalt #-}
diff --git a/src/Network/BitTorrent/Tracker/RPC.hs b/src/Network/BitTorrent/Tracker/RPC.hs
index 0ffb2017..022751b4 100644
--- a/src/Network/BitTorrent/Tracker/RPC.hs
+++ b/src/Network/BitTorrent/Tracker/RPC.hs
@@ -47,10 +47,13 @@ import qualified Network.BitTorrent.Tracker.RPC.UDP as UDP
47-- | Info to advertise to trackers. 47-- | Info to advertise to trackers.
48data PeerInfo = PeerInfo 48data PeerInfo = PeerInfo
49 { peerId :: !PeerId 49 { peerId :: !PeerId
50 , peerPort :: !PortNumber
51 , peerIP :: !(Maybe HostAddress) 50 , peerIP :: !(Maybe HostAddress)
51 , peerPort :: !PortNumber
52 } deriving (Show, Eq) 52 } deriving (Show, Eq)
53 53
54instance Default PeerInfo where
55 def = PeerInfo def Nothing 6881
56
54-- | Simplified announce query. 57-- | Simplified announce query.
55data SAnnounceQuery = SAnnounceQuery 58data SAnnounceQuery = SAnnounceQuery
56 { sInfoHash :: InfoHash 59 { sInfoHash :: InfoHash