diff options
Diffstat (limited to 'examples/testTox.hs')
-rw-r--r-- | examples/testTox.hs | 21 |
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 #-} |
2 | import Control.Concurrent (threadDelay) | 2 | import Control.Concurrent (threadDelay) |
3 | import Control.Concurrent.STM.TChan | 3 | import Control.Concurrent.STM.TChan |
4 | import Control.Concurrent.STM.TMChan | 4 | import Control.Concurrent.STM.TMChan |
5 | import Control.Concurrent.STM.TVar | 5 | import Control.Concurrent.STM.TVar |
@@ -16,7 +16,8 @@ import Network.Tox.ContactInfo | |||
16 | import qualified Network.Tox.Crypto.Handlers as CH | 16 | import qualified Network.Tox.Crypto.Handlers as CH |
17 | import Network.Tox.Crypto.Transport | 17 | import Network.Tox.Crypto.Transport |
18 | import Network.Tox.DHT.Handlers as DHT | 18 | import Network.Tox.DHT.Handlers as DHT |
19 | import Network.Tox.Onion.Transport (UDPTransport) | 19 | import Network.Tox.DHT.Transport |
20 | import Network.Tox.Onion.Transport | ||
20 | 21 | ||
21 | 22 | ||
22 | makeToxNode :: UDPTransport -> Maybe SecretKey -> IO (Tox extra) | 23 | makeToxNode :: 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 | ||