diff options
author | joe <joe@jerkface.net> | 2017-10-19 22:00:34 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-10-19 22:00:34 -0400 |
commit | 987915fb21ac824bfb8fc49c5cceb3aa0f1440c2 (patch) | |
tree | 74fb04e5248f6fa7486216ec5dd1c9ea1258873d /examples/dhtd.hs | |
parent | 27dfb777280028b5ca6dad44f481783d8bab602e (diff) |
Successful toxid announce.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r-- | examples/dhtd.hs | 16 |
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 | |||
45 | import GHC.Conc (labelThread) | 45 | import GHC.Conc (labelThread) |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | import Crypto.Tox (zeros32,SecretKey,PublicKey, generateSecretKey, toPublic, encodeSecret, decodeSecret, userKeys) | 48 | import Crypto.Tox -- (zeros32,SecretKey,PublicKey, generateSecretKey, toPublic, encodeSecret, decodeSecret, userKeys) |
49 | import Network.UPNP as UPNP | 49 | import Network.UPNP as UPNP |
50 | import Network.Address hiding (NodeId, NodeInfo(..)) | 50 | import Network.Address hiding (NodeId, NodeInfo(..)) |
51 | import Network.Kademlia.Search | 51 | import 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 $ |