diff options
Diffstat (limited to 'src/Network/Tox/Transport.hs')
-rw-r--r-- | src/Network/Tox/Transport.hs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Network/Tox/Transport.hs b/src/Network/Tox/Transport.hs index 30df93c8..57f07aad 100644 --- a/src/Network/Tox/Transport.hs +++ b/src/Network/Tox/Transport.hs | |||
@@ -8,6 +8,7 @@ | |||
8 | {-# LANGUAGE TypeOperators #-} | 8 | {-# LANGUAGE TypeOperators #-} |
9 | module Network.Tox.Transport (toxTransport, RouteId) where | 9 | module Network.Tox.Transport (toxTransport, RouteId) where |
10 | 10 | ||
11 | import Data.ByteString (ByteString) | ||
11 | import Network.QueryResponse | 12 | import Network.QueryResponse |
12 | import Crypto.Tox | 13 | import Crypto.Tox |
13 | import Network.Tox.DHT.Transport | 14 | import Network.Tox.DHT.Transport |
@@ -22,21 +23,24 @@ toxTransport :: | |||
22 | -> OnionRouter | 23 | -> OnionRouter |
23 | -> (PublicKey -> IO (Maybe NodeInfo)) | 24 | -> (PublicKey -> IO (Maybe NodeInfo)) |
24 | -> UDPTransport | 25 | -> UDPTransport |
25 | -> IO ( Transport String NodeInfo (DHTMessage Encrypted8) | 26 | -> IO ( Transport String SockAddr (CryptoPacket Encrypted) |
27 | , Transport String NodeInfo (DHTMessage Encrypted8) | ||
26 | , Transport String (OnionDestination RouteId) (OnionMessage Encrypted) | 28 | , Transport String (OnionDestination RouteId) (OnionMessage Encrypted) |
27 | , Transport String AnnouncedRendezvous (PublicKey,OnionData) | 29 | , Transport String AnnouncedRendezvous (PublicKey,OnionData) |
28 | , Transport String SockAddr NetCrypto ) | 30 | , Transport String SockAddr (Handshake Encrypted)) |
29 | toxTransport crypto orouter closeLookup udp = do | 31 | toxTransport crypto orouter closeLookup udp = do |
30 | (dht,udp1) <- partitionTransportM (parseDHTAddr crypto) (fmap Just . encodeDHTAddr) $ forwardOnions crypto udp | 32 | (netcrypto, udp0) <- partitionTransport parseCrypto encodeCrypto udp |
33 | (dht,udp1) <- partitionTransportM (parseDHTAddr crypto) (fmap Just . encodeDHTAddr) $ forwardOnions crypto udp0 | ||
31 | (onion1,udp2) <- partitionTransportM (parseOnionAddr $ lookupSender orouter) | 34 | (onion1,udp2) <- partitionTransportM (parseOnionAddr $ lookupSender orouter) |
32 | (encodeOnionAddr crypto $ lookupRoute orouter) | 35 | (encodeOnionAddr crypto $ lookupRoute orouter) |
33 | udp1 | 36 | udp1 |
34 | (dta,onion) <- partitionTransportM (parseDataToRoute crypto) (encodeDataToRoute crypto) onion1 | 37 | (dta,onion) <- partitionTransportM (parseDataToRoute crypto) (encodeDataToRoute crypto) onion1 |
35 | let netcrypto = layerTransport parseNetCrypto encodeNetCrypto udp2 | 38 | let handshakes = layerTransport parseHandshakes encodeHandshakes udp2 |
36 | return ( forwardDHTRequests crypto closeLookup dht | 39 | return ( netcrypto |
40 | , forwardDHTRequests crypto closeLookup dht | ||
37 | , onion | 41 | , onion |
38 | , dta | 42 | , dta |
39 | , netcrypto | 43 | , handshakes |
40 | ) | 44 | ) |
41 | 45 | ||
42 | 46 | ||