haskell-tor-0.1.1: A Haskell Tor Node

Safe HaskellNone
LanguageHaskell2010

Tor.NetworkStack

Description

Defines the network API required for a Tor implementation to run.

Synopsis

Documentation

data TorNetworkStack lsock sock Source

The type of a Tor-compatible network stack. The first type variable is the type of a listener socket, the second the type of a standard connection socket.

Constructors

TorNetworkStack 

Fields

connect :: String -> Word16 -> IO (Maybe sock)
 
getAddress :: String -> IO [TorAddress]

Lookup the given hostname and return any IP6 (Left) or IP4 (Right) addresses associated with it.

listen :: Word16 -> IO lsock
 
accept :: lsock -> IO (sock, TorAddress)
 
recv :: sock -> Int -> IO ByteString
 
write :: sock -> ByteString -> IO ()
 
flush :: sock -> IO ()
 
close :: sock -> IO ()
 
lclose :: lsock -> IO ()
 

data SomeNetworkStack Source

A network stack, but with the type variables hidden.

Constructors

forall lsock sock . HasBackend sock => MkNS (TorNetworkStack lsock sock) 

toBackend :: TorNetworkStack ls s -> s -> Backend Source

Convert a Tor-compatible network stack to a TLS-compatible Backend structure.

recvAll :: TorNetworkStack ls s -> s -> IO ByteString Source

Receive all the input from the socket as a lazy ByteString; this may cause the system to block upon some ByteString operations to fetch more data.

recvLine :: TorNetworkStack ls s -> s -> IO ByteString Source

Receive a line of ASCII text from a socket.