summaryrefslogtreecommitdiff
path: root/dht/examples/dhtd.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-11-27 22:28:37 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-01 22:50:28 -0500
commit3ebd7ae11d7a86798b31bdb17af9797ba5e09f1d (patch)
treec7290e69f27d5a32869ab20a88f48dba0af62b64 /dht/examples/dhtd.hs
parent557b47bb3e9a39f74b35abcf4bb09cb85f211106 (diff)
TCP Relay: use same crypto keys as Tox UDP node.
Diffstat (limited to 'dht/examples/dhtd.hs')
-rw-r--r--dht/examples/dhtd.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/dht/examples/dhtd.hs b/dht/examples/dhtd.hs
index 68c847c5..5f0eead8 100644
--- a/dht/examples/dhtd.hs
+++ b/dht/examples/dhtd.hs
@@ -698,7 +698,7 @@ clientSession s@Session{..} sock cnum h = do
698 tcnt <- readTVar $ setCount t 698 tcnt <- readTVar $ setCount t
699 icnt <- HashMap.size <$> readTVar (setIDs t) 699 icnt <- HashMap.size <$> readTVar (setIDs t)
700 return (ts,tcnt,icnt) 700 return (ts,tcnt,icnt)
701 (ts,tcnt,icnt) <- trampstate (trampolinesUDP onionRouter) 701 (uts,tcnt,icnt) <- trampstate (trampolinesUDP onionRouter)
702 (tts,ttcnt,ticnt) <- trampstate (trampolinesTCP onionRouter) 702 (tts,ttcnt,ticnt) <- trampstate (trampolinesTCP onionRouter)
703 rs <- getAssocs (pendingRoutes onionRouter) 703 rs <- getAssocs (pendingRoutes onionRouter)
704 pqs <- readTVar (pendingQueries onionRouter) 704 pqs <- readTVar (pendingQueries onionRouter)
@@ -718,9 +718,10 @@ clientSession s@Session{..} sock cnum h = do
718 then show routeVersion 718 then show routeVersion
719 else show routeVersion ++ "(pending)" ] 719 else show routeVersion ++ "(pending)" ]
720 | otherwise = [show n, "error!","","",""] 720 | otherwise = [show n, "error!","","",""]
721 -- otherwise = [show n, "error!",show (IntMap.lookup n rm),show (IntMap.null rm),""]
721 r = map (uncurry showRecord) rs 722 r = map (uncurry showRecord) rs
722 return $ do 723 return $ do
723 hPutClientChunk h $ unlines [ "trampolines(UDP): " ++ show (IntMap.size ts,tcnt,icnt) 724 hPutClientChunk h $ unlines [ "trampolines(UDP): " ++ show (IntMap.size uts,tcnt,icnt)
724 ++ if tcpmode then "" else " *" 725 ++ if tcpmode then "" else " *"
725 , "trampolines(TCP): " ++ show (IntMap.size tts,ttcnt,ticnt) 726 , "trampolines(TCP): " ++ show (IntMap.size tts,ttcnt,ticnt)
726 ++ if tcpmode then " *" else "" 727 ++ if tcpmode then " *" else ""
@@ -1377,12 +1378,13 @@ initTox opts ssvar keysdb mbxmpp invc = case porttox opts of
1377 [""] -> return (Nothing,return (), Map.empty, return [],[]) 1378 [""] -> return (Nothing,return (), Map.empty, return [],[])
1378 toxport -> do 1379 toxport -> do
1379 dput XMisc $ "Supplied key: " ++ show (fmap (Tox.key2id . toPublic) (dhtkey opts)) 1380 dput XMisc $ "Supplied key: " ++ show (fmap (Tox.key2id . toPublic) (dhtkey opts))
1381 crypto <- Tox.newToxCrypto (dhtkey opts)
1380 tox <- Tox.newTox keysdb 1382 tox <- Tox.newTox keysdb
1381 toxport 1383 toxport
1382 (case mbxmpp of 1384 (case mbxmpp of
1383 Nothing -> \_ _ _ -> return () 1385 Nothing -> \_ _ _ -> return ()
1384 Just xmpp -> onNewToxSession xmpp ssvar invc) 1386 Just xmpp -> onNewToxSession xmpp ssvar invc)
1385 (dhtkey opts) 1387 crypto
1386 (\_ _ -> return ()) -- TODO: TCP relay send 1388 (\_ _ -> return ()) -- TODO: TCP relay send
1387 -- addrTox <- getBindAddress toxport (ip6tox opts) 1389 -- addrTox <- getBindAddress toxport (ip6tox opts)
1388 (quitTox, toxStrap4, toxStrap6) <- Tox.forkTox tox (advertiseOnAvahi opts) 1390 (quitTox, toxStrap4, toxStrap6) <- Tox.forkTox tox (advertiseOnAvahi opts)