-- 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.2
-- | This module provides a uniform interface to network connections with
-- optional support for TLS and SOCKS.
module Hookup
-- | Parameters for connect.
data ConnectionParams
ConnectionParams :: Family -> HostName -> PortNumber -> Maybe SocksParams -> Maybe TlsParams -> ConnectionParams
-- | IP Protocol family (default AF_UNSPEC)
[cpFamily] :: ConnectionParams -> Family
-- | 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. These parameters are passed to OpenSSL when
-- making a secure connection.
data TlsParams
TlsParams :: Maybe FilePath -> Maybe FilePath -> Maybe FilePath -> String -> Bool -> TlsParams
-- | Path to client certificate
[tpClientCertificate] :: TlsParams -> Maybe FilePath
-- | Path to client private key
[tpClientPrivateKey] :: TlsParams -> Maybe FilePath
-- | Path to CA certificate bundle
[tpServerCertificate] :: TlsParams -> Maybe FilePath
-- | OpenSSL cipher suite name (e.g. HIGH)
[tpCipherSuite] :: TlsParams -> String
-- | Disables certificate checking
[tpInsecure] :: TlsParams -> Bool
-- | Default Family value is unspecified and allows both INET and
-- INET6.
defaultFamily :: Family
-- | 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 "\r\n" and
-- "\n" are recognized.
--
-- Returning Nothing means that the peer has closed its half of
-- the connection.
--
-- Unterminated lines will raise a LineTruncated exception. This
-- can happen if the peer transmits some data and closes its end without
-- transmitting a line terminator.
--
-- Throws: ConnectionAbruptlyTerminated,
-- ConnectionFailure, IOError
recvLine :: Connection -> Int -> IO (Maybe ByteString)
-- | Send bytes on the network connection.
--
-- 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