diff options
author | joe <joe@jerkface.net> | 2017-10-02 18:27:12 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-10-02 18:27:12 -0400 |
commit | f7a3c6c057244c8ca14bb9c6ad4bdfb4629ac154 (patch) | |
tree | 833b7bd39883e56a16a230244fec04f06d8ac755 /src/Network/Tox/Transport.hs | |
parent | d408e6c3148106c6dbc8afe24a1488619adf34e1 (diff) |
Stubs for maintaining onion routes.
Diffstat (limited to 'src/Network/Tox/Transport.hs')
-rw-r--r-- | src/Network/Tox/Transport.hs | 16 |
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 | |||
13 | import Network.Tox.DHT.Transport | 13 | import Network.Tox.DHT.Transport |
14 | import Network.Tox.Onion.Transport | 14 | import Network.Tox.Onion.Transport |
15 | import Network.Tox.Crypto.Transport | 15 | import Network.Tox.Crypto.Transport |
16 | import OnionRouter | ||
16 | 17 | ||
17 | import Network.Socket | 18 | import Network.Socket |
18 | 19 | ||
19 | type RouteId = () -- todo | ||
20 | |||
21 | lookupSender :: SockAddr -> Nonce8 -> IO (Maybe (NodeInfo, RouteId)) | ||
22 | lookupSender _ _ = return Nothing -- todo | ||
23 | |||
24 | lookupRoute :: NodeInfo -> RouteId -> IO (Maybe OnionRoute) | ||
25 | lookupRoute _ _ = return Nothing -- todo | ||
26 | |||
27 | toxTransport :: | 20 | toxTransport :: |
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 ) |
34 | toxTransport crypto closeLookup udp = do | 28 | toxTransport 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 |