From 78b05bf38b83b5d46468e1f938bb8c2d9dd0804f Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 3 Jul 2017 20:35:07 -0400 Subject: Fleshed out Tox TODO stubs. --- src/Network/BitTorrent/DHT/Query.hs | 1 + src/Network/DatagramServer/Tox.hs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/Network') diff --git a/src/Network/BitTorrent/DHT/Query.hs b/src/Network/BitTorrent/DHT/Query.hs index 330b5478..ad29adb6 100644 --- a/src/Network/BitTorrent/DHT/Query.hs +++ b/src/Network/BitTorrent/DHT/Query.hs @@ -232,6 +232,7 @@ class DataHandlers raw dht where (NodeId dht -> IO [NodeInfo dht ip ()]) -> DHTData dht ip -> [MethodHandler raw dht ip] + dataHandlers _ _ = [] instance DataHandlers BValue KMessageOf where dataHandlers = bthandlers diff --git a/src/Network/DatagramServer/Tox.hs b/src/Network/DatagramServer/Tox.hs index 83701b6b..3a6135cc 100644 --- a/src/Network/DatagramServer/Tox.hs +++ b/src/Network/DatagramServer/Tox.hs @@ -37,7 +37,7 @@ type Nonce24 = Word192 -- 24 bytes data NodeFormat = NodeFormat - { nodePublicKey :: Key32 -- 32 byte public key + { nodePublicKey :: NodeId Message -- 32 byte public key , nodeIsTCP :: Bool -- This has no analog in mainline NodeInfo structure , nodeIP :: IP -- IPv4 or IPv6 address , nodePort :: PortNumber @@ -149,10 +149,10 @@ instance Serialize NodeFormat where return $ NodeFormat { nodeIsTCP = istcp , nodeIP = ip , nodePort = port - , nodePublicKey = pubkey + , nodePublicKey = NodeId pubkey } - put (NodeFormat{..}) = do + put (NodeFormat{ nodePublicKey = NodeId pubkey, ..}) = do put $ case (# nodeIP, nodeIsTCP #) of (# IPv4 _, False #) -> 2 (# IPv4 _, True #) -> 130 @@ -160,7 +160,7 @@ instance Serialize NodeFormat where (# IPv6 _, True #) -> 138 :: Word8 put nodeIP put nodePort - put nodePublicKey + put pubkey -- Note: the char array is a public key, the 32-bytes is provided by libsodium-dev -- in /usr/include/sodium/crypto_box.h as the symbol crypto_box_PUBLICKEYBYTES -- cgit v1.2.3