From 133d40e02714e75b9f528314280f7348da6bba87 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 3 Nov 2017 23:20:17 -0400 Subject: Added --dhtkey option. --- src/Network/Tox.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Network') diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs index 6f591917..9f41fbe5 100644 --- a/src/Network/Tox.hs +++ b/src/Network/Tox.hs @@ -282,12 +282,18 @@ getOnionAlias crypto dhtself remoteNode = atomically $ do return $ Onion.OnionDestination Onion.SearchingAlias alias Nothing -newTox :: TVar Onion.AnnouncedKeys -> SockAddr -> Maybe NetCryptoSessions -> IO Tox -newTox keydb addr mbSessionsState = do +newTox :: TVar Onion.AnnouncedKeys -> SockAddr -> Maybe NetCryptoSessions -> Maybe SecretKey -> IO Tox +newTox keydb addr mbSessionsState suppliedDHTKey = do udp <- addVerbosity <$> udpTransport addr (crypto,sessionsState) <- case mbSessionsState of Nothing -> do - crypto <- newCrypto + crypto0 <- newCrypto + let crypto = fromMaybe crypto0 $do + k <- suppliedDHTKey + return crypto0 + { transportSecret = k + , transportPublic = toPublic k + } sessionsState <- newSessionsState crypto defaultUnRecHook defaultCryptoDataHooks return (crypto,sessionsState) Just s -> return (transportCrypto s, s) -- cgit v1.2.3