-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Abstraction over creating network connections with SOCKS5 and TLS
--
-- This package provides an abstraction for communicating with
-- line-oriented network services while abstracting over the use of
-- SOCKS5 and TLS (via OpenSSL)
@package hookup
@version 0.1.0.0
-- | This module provides a uniform interface to network connections with
-- optional support for TLS and SOCKS.
module Hookup
-- | Parameters for connect.
data ConnectionParams
ConnectionParams :: HostName -> PortNumber -> Maybe SocksParams -> Maybe TlsParams -> ConnectionParams
-- | Destination host
[cpHost] :: ConnectionParams -> HostName
-- | Destination TCP port
[cpPort] :: ConnectionParams -> PortNumber
-- | Optional SOCKS5 parameters
[cpSocks] :: ConnectionParams -> Maybe SocksParams
-- | Optional TLS parameters
[cpTls] :: ConnectionParams -> Maybe TlsParams
-- | SOCKS5 connection parameters
data SocksParams
SocksParams :: HostName -> PortNumber -> SocksParams
-- | SOCKS server host
[spHost] :: SocksParams -> HostName
-- | SOCKS server port
[spPort] :: SocksParams -> PortNumber
-- | TLS connection parameters
data TlsParams
TlsParams :: Maybe FilePath -> Maybe FilePath -> Maybe FilePath -> String -> Bool -> TlsParams
[tpClientCertificate] :: TlsParams -> Maybe FilePath
[tpClientPrivateKey] :: TlsParams -> Maybe FilePath
[tpServerCertificate] :: TlsParams -> Maybe FilePath
[tpCipherSuite] :: TlsParams -> String
[tpInsecure] :: TlsParams -> Bool
-- | A connection to a network service along with its read buffer used for
-- line-oriented protocols. The connection could be a plain network
-- connection, SOCKS connected, or TLS.
data Connection
-- | Open network connection to TCP service specified by the given
-- parameters.
--
-- Throws IOError, SocksError, ProtocolError,
-- ConnectionFailure
connect :: ConnectionParams -> IO Connection
-- | Receive a line from the network connection. Both "rn" and
-- "n" are recognized.
--
-- Throws: ConnectionAbruptlyTerminated,
-- ConnectionFailure, IOError
recvLine :: Connection -> Int -> IO (Maybe ByteString)
-- | Send bytes on the network connection. Ensures that the whole message
-- is sent.
--
-- Throws: IOError, ProtocolError
send :: Connection -> ByteString -> IO ()
-- | Close network connection.
close :: Connection -> IO ()
-- | Type for errors that can be thrown by this package.
data ConnectionFailure
-- | Failure during getAddrInfo resolving remote host
HostnameResolutionFailure :: IOError -> ConnectionFailure
-- | Failure during connect to remote host
ConnectionFailure :: [IOError] -> ConnectionFailure
-- | Failure during recvLine
LineTooLong :: ConnectionFailure
-- | Incomplete line during recvLine
LineTruncated :: ConnectionFailure
instance GHC.Show.Show Hookup.ConnectionFailure
instance GHC.Exception.Exception Hookup.ConnectionFailure