network-conduit-tls-1.1.0: Create TLS-aware network code with conduits

Safe HaskellNone

Data.Conduit.Network.TLS

Contents

Synopsis

Server

tlsConfigBSSource

Arguments

:: HostPreference 
-> Int

port

-> ByteString

Certificate raw data

-> ByteString

Key file raw data

-> TLSConfig 

allow to build a server config directly from raw bytestring data (exact same string as if the certificates were read from the filesystem). this enables to plug another backend to fetch certifcates (other than FS)

tlsConfigSource

Arguments

:: HostPreference 
-> Int

port

-> FilePath

certificate

-> FilePath

key

-> TLSConfig 

tlsAppDataSource

Arguments

:: Context

a TLS context

-> SockAddr

remote address

-> Maybe SockAddr

local address

-> AppData 

Create an AppData from an existing tls Context value. This is a lower level function, allowing you to create a connection in any way you want.

Sample usage:

 import Network.Simple.TCP.TLS

 myapp :: Application IO
 ...
 main = do
     cset <- getDefaultClientSettings
     connect cset "host" "port" $
         (\(ctx, addr) -> myapp $ tlsAppData ctx addr Nothing)

Since 1.0.1

runTCPServerStartTLS :: TLSConfig -> ApplicationStartTLS -> IO ()Source

run a server un-crypted but also pass a call-back to trigger a StartTLS handshake on the underlying connection

example usage : runTCPServerStartTLS serverConfig $ (appData,startTLS) -> do abortTLS <- doSomethingInClear appData unless (abortTLS) $ startTls $ appDataTls -> do doSomethingSSL appDataTls

Client

data TLSClientConfig Source

Settings type for TLS client connection.

Since 1.0.2

tlsClientConfigSource

Arguments

:: Int

port

-> ByteString

host

-> TLSClientConfig 

Smart constructor for TLSClientConfig.

Since 1.0.2

runTLSClient :: (MonadIO m, MonadBaseControl IO m) => TLSClientConfig -> (AppData -> m a) -> m aSource

Run an application with the given configuration.

Since 1.0.2

runTLSClientStartTLS :: TLSClientConfig -> ApplicationStartTLS -> IO ()Source

Run an application with the given configuration. starting with a clear connection but provide also a call back to trigger a StartTLS handshake on the connection

Since 1.0.2

tlsClientUseTLS :: TLSClientConfig -> BoolSource

Default is True. If set to False, will make a non-TLS connection.

Since 1.0.2

tlsClientTLSSettings :: TLSClientConfig -> TLSSettingsSource

TLS settings to use. If not provided, defaults will be provided.

Since 1.0.2

tlsClientSockSettings :: TLSClientConfig -> Maybe SockSettingsSource

Socks configuration; default is Nothing. If absent, Socks will not be used.

Since 1.0.2

tlsClientConnectionContext :: TLSClientConfig -> Maybe ConnectionContextSource

Connection context. Default is Nothing, which will generate a new context automatically. If you will be making many connections, it's recommended to call initConnectionContext yourself.

Since 1.0.2