summaryrefslogtreecommitdiff
path: root/dht/examples/toxrelay.hs
blob: af08e8d7b4ece03fb09ec6ba761bf029c6783e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import Network.Address (getBindAddress)
import Network.SocketLike
import Network.StreamServer
import Network.Tox.Onion.Transport hiding (encrypt,decrypt)
import Network.Tox.Relay

main :: IO ()
main = do
    udp_addr <- getBindAddress "33445" True
    let sendOnion :: SockAddr -> OnionRequest N1 -> IO ()
        sendOnion _ _ = return ()
    (h,sendTCP) <- tcpRelay udp_addr sendOnion
    boundPort <- socketPort $ listenSocket h
    putStrLn $ "Listening on port: " ++ show boundPort

    putStrLn $ "ENTER to quit..."
    s <- getLine

    quitListening h