summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/BitTorrent/Client/Types.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Client/Types.hs b/src/Network/BitTorrent/Client/Types.hs
index 603142d5..e80578a3 100644
--- a/src/Network/BitTorrent/Client/Types.hs
+++ b/src/Network/BitTorrent/Client/Types.hs
@@ -3,6 +3,7 @@ module Network.BitTorrent.Client.Types
3 ( -- * Core types 3 ( -- * Core types
4 Handle (..) 4 Handle (..)
5 , Client (..) 5 , Client (..)
6 , externalAddr
6 7
7 -- * Monad BitTorrent 8 -- * Monad BitTorrent
8 , BitTorrent (..) 9 , BitTorrent (..)
@@ -52,6 +53,16 @@ instance Eq Client where
52instance Ord Client where 53instance Ord Client where
53 compare = comparing clientPeerId 54 compare = comparing clientPeerId
54 55
56-- | External IP address of a host running a bittorrent client
57-- software may be used to acknowledge remote peer the host connected
58-- to. See 'Network.BitTorrent.Exchange.Message.ExtendedHandshake'.
59externalAddr :: Client -> PeerAddr (Maybe IP)
60externalAddr Client {..} = PeerAddr
61 { peerId = Just clientPeerId
62 , peerHost = Nothing -- TODO return external IP address, if known
63 , peerPort = clientListenerPort
64 }
65
55{----------------------------------------------------------------------- 66{-----------------------------------------------------------------------
56-- BitTorrent monad 67-- BitTorrent monad
57-----------------------------------------------------------------------} 68-----------------------------------------------------------------------}