Safe Haskell | None |
---|
This module exports functions that allow you to use TLS-secured TCP connections in a streaming fashion.
You are encouraged to use this module together with Network.Simple.TCP.TLS as follows:
import qualified Network.Simple.TCP.TLS as TLS import qualified Pipes.Network.TCP.TLS as TLS
This module does not export facilities that would allow you to establish new connections within a pipeline. If you need to do so, then you should use Pipes.Network.TCP.TLS.Safe instead, which exports a similar API to the one exported by this module. Don't be confused by the word “safe” in that module; this module is equally safe to use as long as you don't try to acquire new resources within the pipeline.
- fromContext :: MonadIO m => Context -> Producer' ByteString m ()
- fromContextTimeout :: MonadIO m => Int -> Context -> Producer' ByteString m ()
- toContext :: MonadIO m => Context -> Consumer' ByteString m r
- toContextTimeout :: MonadIO m => Int -> Context -> Consumer' ByteString m r
Receiving
The following pipes allow you to receive bytes from the remote end over a TLS-secured TCP connection.
Besides the pipes below, you might want to use Network.Simple.TCP.TLS's
recv
, which happens to be an Effect'
:
recv
::MonadIO
m =>Context
->Effect'
m (Maybe
ByteString
)
:: MonadIO m | |
=> Context | Established TLS connection context. |
-> Producer' ByteString m () |
Receives decrypted bytes from the remote end and sends them downstream.
The number of bytes received at once is always in the interval [1 .. 16384].
The TLS connection is automatically renegotiated if a ClientHello message is received.
This Producer'
returns if the remote peer closes its side of the connection
or EOF is received.
:: MonadIO m | |
=> Int | Timeout in microseconds (1/10^6 seconds). |
-> Context | Established TLS connection context. |
-> Producer' ByteString m () |
Like fromContext
, except with the first Int
argument you can specify
the maximum time that each interaction with the remote end can take. If such
time elapses before the interaction finishes, then an IOError
exception is
thrown. The time is specified in microseconds (10e6).
Sending
The following pipes allow you to send bytes to the remote end over a TLS-secured TCP connection.
Besides the pipes below, you might want to use Network.Simple.TCP.TLS's
send
, which happens to be an Effect'
:
send
::MonadIO
m =>Context
->ByteString
->Effect'
m ()
:: MonadIO m | |
=> Context | Established TLS connection context. |
-> Consumer' ByteString m r |
Encrypts and sends to the remote end each ByteString
received from
upstream.
:: MonadIO m | |
=> Int | Timeout in microseconds (1/10^6 seconds). |
-> Context | Established TLS connection context. |
-> Consumer' ByteString m r |