summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Transport.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-10-02 18:27:12 -0400
committerjoe <joe@jerkface.net>2017-10-02 18:27:12 -0400
commitf7a3c6c057244c8ca14bb9c6ad4bdfb4629ac154 (patch)
tree833b7bd39883e56a16a230244fec04f06d8ac755 /src/Network/Tox/Transport.hs
parentd408e6c3148106c6dbc8afe24a1488619adf34e1 (diff)
Stubs for maintaining onion routes.
Diffstat (limited to 'src/Network/Tox/Transport.hs')
-rw-r--r--src/Network/Tox/Transport.hs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/Network/Tox/Transport.hs b/src/Network/Tox/Transport.hs
index d441dc0a..d4e1a754 100644
--- a/src/Network/Tox/Transport.hs
+++ b/src/Network/Tox/Transport.hs
@@ -13,28 +13,22 @@ import Crypto.Tox
13import Network.Tox.DHT.Transport 13import Network.Tox.DHT.Transport
14import Network.Tox.Onion.Transport 14import Network.Tox.Onion.Transport
15import Network.Tox.Crypto.Transport 15import Network.Tox.Crypto.Transport
16import OnionRouter
16 17
17import Network.Socket 18import Network.Socket
18 19
19type RouteId = () -- todo
20
21lookupSender :: SockAddr -> Nonce8 -> IO (Maybe (NodeInfo, RouteId))
22lookupSender _ _ = return Nothing -- todo
23
24lookupRoute :: NodeInfo -> RouteId -> IO (Maybe OnionRoute)
25lookupRoute _ _ = return Nothing -- todo
26
27toxTransport :: 20toxTransport ::
28 TransportCrypto 21 TransportCrypto
22 -> OnionRouter
29 -> (PublicKey -> IO (Maybe NodeInfo)) 23 -> (PublicKey -> IO (Maybe NodeInfo))
30 -> UDPTransport 24 -> UDPTransport
31 -> IO ( Transport String NodeInfo (DHTMessage Encrypted8) 25 -> IO ( Transport String NodeInfo (DHTMessage Encrypted8)
32 , Transport String (OnionDestination RouteId) (OnionMessage Encrypted) 26 , Transport String (OnionDestination RouteId) (OnionMessage Encrypted)
33 , Transport String SockAddr NetCrypto ) 27 , Transport String SockAddr NetCrypto )
34toxTransport crypto closeLookup udp = do 28toxTransport crypto orouter closeLookup udp = do
35 (dht,udp1) <- partitionTransport parseDHTAddr (Just . encodeDHTAddr) $ forwardOnions crypto udp 29 (dht,udp1) <- partitionTransport parseDHTAddr (Just . encodeDHTAddr) $ forwardOnions crypto udp
36 (onion,udp2) <- partitionTransportM (parseOnionAddr lookupSender) 30 (onion,udp2) <- partitionTransportM (parseOnionAddr $ lookupSender orouter)
37 (encodeOnionAddr lookupRoute) 31 (encodeOnionAddr $ lookupRoute orouter)
38 udp1 32 udp1
39 let netcrypto = layerTransport parseNetCrypto encodeNetCrypto udp2 33 let netcrypto = layerTransport parseNetCrypto encodeNetCrypto udp2
40 return ( forwardDHTRequests crypto closeLookup dht 34 return ( forwardDHTRequests crypto closeLookup dht