summaryrefslogtreecommitdiff
path: root/examples/testTox.hs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/testTox.hs')
-rw-r--r--examples/testTox.hs21
1 files changed, 19 insertions, 2 deletions
diff --git a/examples/testTox.hs b/examples/testTox.hs
index 53ed25dc..53cb3586 100644
--- a/examples/testTox.hs
+++ b/examples/testTox.hs
@@ -1,5 +1,5 @@
1{-# LANGUAGE NamedFieldPuns #-} 1{-# LANGUAGE NamedFieldPuns #-}
2import Control.Concurrent (threadDelay) 2import Control.Concurrent (threadDelay)
3import Control.Concurrent.STM.TChan 3import Control.Concurrent.STM.TChan
4import Control.Concurrent.STM.TMChan 4import Control.Concurrent.STM.TMChan
5import Control.Concurrent.STM.TVar 5import Control.Concurrent.STM.TVar
@@ -16,7 +16,8 @@ import Network.Tox.ContactInfo
16import qualified Network.Tox.Crypto.Handlers as CH 16import qualified Network.Tox.Crypto.Handlers as CH
17import Network.Tox.Crypto.Transport 17import Network.Tox.Crypto.Transport
18import Network.Tox.DHT.Handlers as DHT 18import Network.Tox.DHT.Handlers as DHT
19import Network.Tox.Onion.Transport (UDPTransport) 19import Network.Tox.DHT.Transport
20import Network.Tox.Onion.Transport
20 21
21 22
22makeToxNode :: UDPTransport -> Maybe SecretKey -> IO (Tox extra) 23makeToxNode :: UDPTransport -> Maybe SecretKey -> IO (Tox extra)
@@ -75,8 +76,24 @@ main = do
75 76
76 threadReport False >>= putStrLn 77 threadReport False >>= putStrLn
77 78
79 -- Tell /a/ about /b/'s DHT-key.
80 updateContactInfo (toxContactInfo a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf)
81 (AnnouncedRendezvous (id2key $ read "AvETKhO-YqnNRopZrj8K3xUpGtGbX0sLhZZjh2VufJB") -- b toxid
82 (Rendezvous (error "pointless mitm key") b))
83 $ ( id2key $ read "BDDj3maMmK8hR3mTpju29wmtE2YJ5cf8NlNEWi1dXlI" -- a toxid
84 , OnionDHTPublicKey DHTPublicKey
85 { dhtpkNonce = 0
86 , dhtpk = id2key $ nodeId b
87 , dhtpkNodes = SendNodes []
88 }
89 )
90
78 DHT.ping (toxDHT a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) b 91 DHT.ping (toxDHT a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) b
79 92
93
94 -- sendMessage (toxHandshakes a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) (nodeAddr b) hs
95
96
80 putStrLn "Type Enter to quit..." 97 putStrLn "Type Enter to quit..."
81 getLine 98 getLine
82 99