hookup-0.1.0.0: Abstraction over creating network connections with SOCKS5 and TLS

Copyright(c) Eric Mertens, 2016
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Hookup

Contents

Description

This module provides a uniform interface to network connections with optional support for TLS and SOCKS.

Synopsis

Configuration

data ConnectionParams Source #

Parameters for connect.

Constructors

ConnectionParams 

Fields

data SocksParams Source #

SOCKS5 connection parameters

Constructors

SocksParams 

Fields

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 "rn" and "n" are recognized.

Throws: ConnectionAbruptlyTerminated, ConnectionFailure, IOError

send :: Connection -> ByteString -> IO () Source #

Send bytes on the network connection. Ensures that the whole message is sent.

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 getAddrInfo resolving remote host

ConnectionFailure [IOError]

Failure during connect to remote host

LineTooLong

Failure during recvLine

LineTruncated

Incomplete line during recvLine