summaryrefslogtreecommitdiff
path: root/examples/dhtd.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-10-19 22:00:34 -0400
committerjoe <joe@jerkface.net>2017-10-19 22:00:34 -0400
commit987915fb21ac824bfb8fc49c5cceb3aa0f1440c2 (patch)
tree74fb04e5248f6fa7486216ec5dd1c9ea1258873d /examples/dhtd.hs
parent27dfb777280028b5ca6dad44f481783d8bab602e (diff)
Successful toxid announce.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r--examples/dhtd.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index 1e2c1467..e285d2d2 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -45,7 +45,7 @@ import Control.Concurrent.Lifted
45import GHC.Conc (labelThread) 45import GHC.Conc (labelThread)
46#endif 46#endif
47 47
48import Crypto.Tox (zeros32,SecretKey,PublicKey, generateSecretKey, toPublic, encodeSecret, decodeSecret, userKeys) 48import Crypto.Tox -- (zeros32,SecretKey,PublicKey, generateSecretKey, toPublic, encodeSecret, decodeSecret, userKeys)
49import Network.UPNP as UPNP 49import Network.UPNP as UPNP
50import Network.Address hiding (NodeId, NodeInfo(..)) 50import Network.Address hiding (NodeId, NodeInfo(..))
51import Network.Kademlia.Search 51import Network.Kademlia.Search
@@ -699,7 +699,7 @@ main = do
699 <*> Tox.announceH (Tox.toxRouting tox) 699 <*> Tox.announceH (Tox.toxRouting tox)
700 (Tox.toxTokens tox) 700 (Tox.toxTokens tox)
701 (Tox.toxAnnouncedKeys tox) 701 (Tox.toxAnnouncedKeys tox)
702 (Tox.OnionDestination ni Nothing) 702 (Tox.OnionDestination Tox.SearchingAlias ni Nothing)
703 (Tox.AnnounceRequest zeros32 nid Tox.zeroID)) 703 (Tox.AnnounceRequest zeros32 nid Tox.zeroID))
704 show -- PublicKey 704 show -- PublicKey
705 (fmap show)) 705 (fmap show))
@@ -714,15 +714,17 @@ main = do
714 (Tox.onionTimeout tox) 714 (Tox.onionTimeout tox)
715 (Tox.toxCryptoKeys tox) 715 (Tox.toxCryptoKeys tox)
716 (Tox.toxOnion tox) 716 (Tox.toxOnion tox)
717 pubkey 717 (pubkey :: PublicKey)
718 token 718 (token :: Nonce32)
719 ni 719 ni
720 Nothing -> return Nothing 720 Nothing -> return Nothing
721 , announceParseData = \str tokstr -> 721 , announceParseData = \str tokstr -> do
722 return $ do 722 r <- return $ do
723 pubkey <- Tox.id2key <$> readEither str 723 pubkey <- Tox.id2key <$> readEither str
724 tok <- readEither tokstr 724 tok <- readEither tokstr
725 Right (pubkey,tok) 725 Right (pubkey :: PublicKey, tok :: Nonce32)
726 hPutStrLn stderr ("PARSED(toxid): "++show (fmap (Control.Arrow.first Tox.key2id) r))
727 return r
726 })] 728 })]
727 } 729 }
728 dhts = Map.fromList $ 730 dhts = Map.fromList $