summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-12-01 13:49:39 -0500
committerJoe Crayne <joe@jerkface.net>2018-12-16 14:08:26 -0500
commitbecfb0788cadcf31055b9a0e146e57caa7d44c61 (patch)
treebac32c3e0a88a4af6149e26ba061659fe8801c67
parent04f629c7452d4db3400fc82793317cfec52b4680 (diff)
TCP Relay Server library module.
-rw-r--r--src/Network/Tox/Relay.hs (renamed from examples/toxrelay.hs)14
1 files changed, 1 insertions, 13 deletions
diff --git a/examples/toxrelay.hs b/src/Network/Tox/Relay.hs
index 2743c5d8..17bbc379 100644
--- a/examples/toxrelay.hs
+++ b/src/Network/Tox/Relay.hs
@@ -1,6 +1,7 @@
1{-# LANGUAGE LambdaCase #-} 1{-# LANGUAGE LambdaCase #-}
2{-# LANGUAGE RecordWildCards #-} 2{-# LANGUAGE RecordWildCards #-}
3{-# LANGUAGE ScopedTypeVariables #-} 3{-# LANGUAGE ScopedTypeVariables #-}
4module Network.Tox.Relay (tcpRelay) where
4 5
5import Control.Concurrent.MVar 6import Control.Concurrent.MVar
6import Control.Concurrent.STM 7import Control.Concurrent.STM
@@ -232,16 +233,3 @@ tcpRelay udp_addr sendOnion = do
232 [b443,b80,udp_addr,b33445,bany] 233 [b443,b80,udp_addr,b33445,bany]
233 return (h,sendTCP_ clients) 234 return (h,sendTCP_ clients)
234 235
235main :: IO ()
236main = do
237 udp_addr <- getBindAddress "33445" True
238 let sendOnion :: SockAddr -> OnionRequest N1 -> IO ()
239 sendOnion _ _ = return ()
240 (h,sendTCP) <- tcpRelay udp_addr sendOnion
241 boundPort <- socketPort $ listenSocket h
242 putStrLn $ "Listening on port: " ++ show boundPort
243
244 putStrLn $ "ENTER to quit..."
245 s <- getLine
246
247 quitListening h