summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Transport.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-11-30 22:37:30 -0500
committerJoe Crayne <joe@jerkface.net>2018-12-16 14:08:26 -0500
commitda35152c9a0da38f815798c5f6b6b9a0362fd330 (patch)
treeaa11ed3965c997fbe4d5fde69160bd87a68093ec /src/Network/Tox/Transport.hs
parent59aa0062c15610015a6bce077be5da1d3ed34019 (diff)
Onion: Support for forwarding from a TCP-relay.
Diffstat (limited to 'src/Network/Tox/Transport.hs')
-rw-r--r--src/Network/Tox/Transport.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Network/Tox/Transport.hs b/src/Network/Tox/Transport.hs
index 0b03ed19..0b34e8f8 100644
--- a/src/Network/Tox/Transport.hs
+++ b/src/Network/Tox/Transport.hs
@@ -22,14 +22,15 @@ toxTransport ::
22 -> OnionRouter 22 -> OnionRouter
23 -> (PublicKey -> IO (Maybe NodeInfo)) 23 -> (PublicKey -> IO (Maybe NodeInfo))
24 -> UDPTransport 24 -> UDPTransport
25 -> (Int -> OnionResponse N1 -> IO ()) -- ^ TCP-bound callback.
25 -> IO ( Transport String SockAddr (CryptoPacket Encrypted) 26 -> IO ( Transport String SockAddr (CryptoPacket Encrypted)
26 , Transport String NodeInfo (DHTMessage Encrypted8) 27 , Transport String NodeInfo (DHTMessage Encrypted8)
27 , Transport String (OnionDestination RouteId) (OnionMessage Encrypted) 28 , Transport String (OnionDestination RouteId) (OnionMessage Encrypted)
28 , Transport String AnnouncedRendezvous (PublicKey,OnionData) 29 , Transport String AnnouncedRendezvous (PublicKey,OnionData)
29 , Transport String SockAddr (Handshake Encrypted)) 30 , Transport String SockAddr (Handshake Encrypted))
30toxTransport crypto orouter closeLookup udp = do 31toxTransport crypto orouter closeLookup udp tcp = do
31 (netcrypto, udp0) <- partitionTransport parseCrypto encodeCrypto udp 32 (netcrypto, udp0) <- partitionTransport parseCrypto encodeCrypto udp
32 (dht,udp1) <- partitionTransportM (parseDHTAddr crypto) (fmap Just . encodeDHTAddr) $ forwardOnions crypto udp0 33 (dht,udp1) <- partitionTransportM (parseDHTAddr crypto) (fmap Just . encodeDHTAddr) $ forwardOnions crypto udp0 tcp
33 (onion1,udp2) <- partitionTransportM (parseOnionAddr $ lookupSender orouter) 34 (onion1,udp2) <- partitionTransportM (parseOnionAddr $ lookupSender orouter)
34 (encodeOnionAddr crypto $ lookupRoute orouter) 35 (encodeOnionAddr crypto $ lookupRoute orouter)
35 udp1 36 udp1