Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides convenience functions for interfacing io-streams
with tls
. the default receive buffer size is decided by tls
.
sending is unbuffered, anything write into OutputStream
will be
immediately send to underlying socket.
The same exceptions rule which applied to TCP apply here, with addtional
TLSException
to be watched out.
This module is intended to be imported qualified
, e.g.:
import qualified Data.TLSSetting as TLS import qualified System.IO.Streams.TLS as TLS
- connect :: ClientParams -> Maybe String -> HostName -> PortNumber -> IO (InputStream ByteString, OutputStream ByteString, Context)
- withConnection :: ClientParams -> Maybe HostName -> HostName -> PortNumber -> (InputStream ByteString -> OutputStream ByteString -> Context -> IO a) -> IO a
- accept :: ServerParams -> Socket -> IO (InputStream ByteString, OutputStream ByteString, Context, SockAddr)
- tlsToStreams :: Context -> IO (InputStream ByteString, OutputStream ByteString)
- close :: Context -> IO ()
- module Data.TLSSetting
client
:: ClientParams | check Data.TLSSetting. |
-> Maybe String | Optional certificate subject name, if set to |
-> HostName | hostname to connect to |
-> PortNumber | port number to connect to |
-> IO (InputStream ByteString, OutputStream ByteString, Context) |
Convenience function for initiating an TLS connection to the given
(
combination.HostName
, PortNumber
)
Note that sending an end-of-file to the returned OutputStream
will not
close the underlying TLS connection; to do that, call close
this operation will throw TLSException
on failure.
:: ClientParams | |
-> Maybe HostName | |
-> HostName | |
-> PortNumber | |
-> (InputStream ByteString -> OutputStream ByteString -> Context -> IO a) | Action to run with the new connection |
-> IO a |
Convenience function for initiating an TLS connection to the given
(
combination. The socket and TLS connection are
closed and deleted after the user handler runs.HostName
, PortNumber
)
server
:: ServerParams | check Data.TLSSetting. |
-> Socket | the listening |
-> IO (InputStream ByteString, OutputStream ByteString, Context, SockAddr) |
Accept a new connection from remote client, return a InputStream
/ OutputStream
pair and remote SockAddr
, you should call bindAndListen
first.
this operation will throw TLSException
on failure.
helpers
:: Context | TLS connection object |
-> IO (InputStream ByteString, OutputStream ByteString) |
Given an existing TLS Context
connection, produces an InputStream
/
OutputStream
pair.
re-export helpers
module Data.TLSSetting