From f7a3c6c057244c8ca14bb9c6ad4bdfb4629ac154 Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 2 Oct 2017 18:27:12 -0400 Subject: Stubs for maintaining onion routes. --- OnionRouter.hs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 OnionRouter.hs (limited to 'OnionRouter.hs') diff --git a/OnionRouter.hs b/OnionRouter.hs new file mode 100644 index 00000000..15304221 --- /dev/null +++ b/OnionRouter.hs @@ -0,0 +1,31 @@ +module OnionRouter where + +import Crypto.Tox +import Network.Kademlia +import Network.Kademlia.Routing +import Network.QueryResponse +import Network.Tox.NodeId +import Network.Tox.Onion.Transport + +import Network.Socket (SockAddr) +import Control.Concurrent.STM + +newtype RouteId = RouteId Int + deriving Show + +data OnionRouter + +newOnionRouter :: IO OnionRouter +newOnionRouter = return _todo + +lookupSender :: OnionRouter -> SockAddr -> Nonce8 -> IO (Maybe (NodeInfo, RouteId)) +lookupSender _ _ _ = return Nothing -- todo + +lookupRoute :: OnionRouter -> NodeInfo -> RouteId -> IO (Maybe OnionRoute) +lookupRoute _ _ _ = return Nothing -- todo + +hookQueries :: OnionRouter -> (tid -> Nonce8) -> TransactionMethods d tid x -> TransactionMethods d tid x +hookQueries _ n8 tmethods = tmethods -- todo + +hookBucketList :: OnionRouter -> RoutingTransition ni -> STM () +hookBucketList _ _ = return () -- todo -- cgit v1.2.3