| Copyright | (c) Eric Mertens 2016 |
|---|---|
| License | ISC |
| Maintainer | emertens@gmail.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Hookup
Contents
Description
This module provides a uniform interface to network connections with optional support for TLS and SOCKS.
- data ConnectionParams = ConnectionParams {}
- data SocksParams = SocksParams {
- spHost :: HostName
- spPort :: PortNumber
- data TlsParams = TlsParams {}
- defaultFamily :: Family
- data Connection
- connect :: ConnectionParams -> IO Connection
- recvLine :: Connection -> Int -> IO (Maybe ByteString)
- send :: Connection -> ByteString -> IO ()
- close :: Connection -> IO ()
- data ConnectionFailure
Configuration
data SocksParams Source #
SOCKS5 connection parameters
Constructors
| SocksParams | |
Fields
| |
TLS connection parameters. These parameters are passed to OpenSSL when making a secure connection.
Constructors
| TlsParams | |
Fields
| |
defaultFamily :: Family Source #
Default Family value is unspecified and allows both INET and INET6.
Connections
data Connection Source #
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.
connect :: ConnectionParams -> IO Connection Source #
Open network connection to TCP service specified by the given parameters.
Throws IOError, SocksError, ProtocolError, ConnectionFailure
recvLine :: Connection -> Int -> IO (Maybe ByteString) Source #
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
send :: Connection -> ByteString -> IO () Source #
Send bytes on the network connection.
Throws: IOError, ProtocolError
close :: Connection -> IO () Source #
Close network connection.
Errors
data ConnectionFailure Source #
Type for errors that can be thrown by this package.
Constructors
| HostnameResolutionFailure IOError | Failure during |
| ConnectionFailure [IOError] | Failure during |
| LineTooLong | Failure during |
| LineTruncated | Incomplete line during |
Instances
| Show ConnectionFailure Source # | |
| Exception ConnectionFailure Source # |
|