summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/MainlineDHT.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-10-16 19:22:53 -0400
committerjoe <joe@jerkface.net>2017-10-16 19:22:53 -0400
commit35aed24bdd67cecbd77e0c64c6c054e736aac787 (patch)
tree6211ae95a2ba74f181e7fb7f93c736bf44c71960 /src/Network/BitTorrent/MainlineDHT.hs
parentc75c9c8714b1e2f489ac5fe365ecda618c8da872 (diff)
Untested announce-peer command for bittorrent dht.
Diffstat (limited to 'src/Network/BitTorrent/MainlineDHT.hs')
-rw-r--r--src/Network/BitTorrent/MainlineDHT.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/MainlineDHT.hs b/src/Network/BitTorrent/MainlineDHT.hs
index f4ce4019..a7359bda 100644
--- a/src/Network/BitTorrent/MainlineDHT.hs
+++ b/src/Network/BitTorrent/MainlineDHT.hs
@@ -906,6 +906,15 @@ data Announce = Announce
906 906
907 } deriving (Show, Eq, Typeable) 907 } deriving (Show, Eq, Typeable)
908 908
909mkAnnounce :: PortNumber -> InfoHash -> Token -> Announce
910mkAnnounce portnum info token = Announce
911 { topic = info
912 , port = portnum
913 , sessionToken = token
914 , announcedName = Nothing
915 , impliedPort = False
916 }
917
909peer_ip_key = "ip" 918peer_ip_key = "ip"
910peer_id_key = "peer id" 919peer_id_key = "peer id"
911peer_port_key = "port" 920peer_port_key = "port"
@@ -1078,3 +1087,6 @@ resolve want hostAndPort = do
1078 return $ addrAddress info 1087 return $ addrAddress info
1079 1088
1080 1089
1090announce :: MainlineClient -> Announce -> NodeInfo -> IO (Maybe Announced)
1091announce client msg addr = do
1092 mainlineSend (Method "announce_peer") id (\() -> msg) client () addr