-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Create TLS-aware network code with conduits
--   
--   Uses the tls package for a pure-Haskell implementation.
@package network-conduit-tls
@version 1.4.0.1

module Data.Conduit.Network.TLS.Internal
data TLSConfig
TLSConfig :: HostPreference -> Int -> TlsCertData -> Bool -> TLSConfig
[tlsHost] :: TLSConfig -> HostPreference
[tlsPort] :: TLSConfig -> Int
[tlsCertData] :: TLSConfig -> TlsCertData
[tlsNeedLocalAddr] :: TLSConfig -> Bool
data TlsCertData
TlsCertData :: IO ByteString -> IO [ByteString] -> IO ByteString -> TlsCertData
[getTLSCert] :: TlsCertData -> IO ByteString
[getTLSChainCerts] :: TlsCertData -> IO [ByteString]
[getTLSKey] :: TlsCertData -> IO ByteString

module Data.Conduit.Network.TLS
type ApplicationStartTLS = GeneralApplicationStartTLS IO ()

type GeneralApplicationStartTLS (m :: Type -> Type) a = (AppData, AppData -> m () -> m ()) -> m a
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)
tlsConfigBS :: HostPreference -> Int -> ByteString -> ByteString -> TLSConfig
tlsConfig :: HostPreference -> Int -> FilePath -> FilePath -> TLSConfig

-- | Like tlsConfigBS, but also allow specifying chain certificates.
--   
--   Since 1.1.1
tlsConfigChainBS :: HostPreference -> Int -> ByteString -> [ByteString] -> ByteString -> TLSConfig

-- | Like tlsConfig, but also allow specifying chain certificates.
--   
--   Since 1.1.1
tlsConfigChain :: HostPreference -> Int -> FilePath -> [FilePath] -> FilePath -> TLSConfig
tlsHost :: TLSConfig -> HostPreference
tlsPort :: TLSConfig -> Int
tlsNeedLocalAddr :: TLSConfig -> Bool

-- | 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
tlsAppData :: Context -> SockAddr -> Maybe SockAddr -> AppData
runTCPServerTLS :: TLSConfig -> (AppData -> IO ()) -> IO ()

-- | Like runTCPServerTLS, but monad can be any instance of
--   MonadUnliftIO.
--   
--   Note that any changes to the monadic state performed by individual
--   client handlers will be discarded. If you have mutable state you want
--   to share among multiple handlers, you need to use some kind of mutable
--   variables.
--   
--   Since 1.1.2
runGeneralTCPServerTLS :: MonadUnliftIO m => TLSConfig -> (AppData -> m ()) -> m ()

-- | run a server un-crypted but also pass a call-back to trigger a
--   StartTLS handshake on the underlying connection
--   
--   Sample usage:
--   
--   
--   runTCPServerStartTLS serverConfig $ \(appData,startTLS) -> do
--     abortTLS <- doSomethingInClear appData
--     unless abortTLS $ startTls $ \appDataTls -> do
--       doSomethingSSL appDataTls
--   
runTCPServerStartTLS :: MonadUnliftIO m => TLSConfig -> GeneralApplicationStartTLS m () -> m ()

-- | Settings type for TLS client connection.
--   
--   Since 1.0.2
data TLSClientConfig

-- | Smart constructor for TLSClientConfig.
--   
--   Since 1.0.2
tlsClientConfig :: Int -> ByteString -> TLSClientConfig

-- | Run an application with the given configuration.
--   
--   Since 1.0.2
runTLSClient :: MonadUnliftIO m => TLSClientConfig -> (AppData -> m a) -> m a

-- | 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
runTLSClientStartTLS :: MonadUnliftIO m => TLSClientConfig -> GeneralApplicationStartTLS m a -> m a

-- | Since 1.0.2
tlsClientPort :: TLSClientConfig -> Int

-- | Since 1.0.2
tlsClientHost :: TLSClientConfig -> ByteString

-- | Default is True. If set to False, will make a non-TLS
--   connection.
--   
--   Since 1.0.2
tlsClientUseTLS :: TLSClientConfig -> Bool

-- | TLS settings to use. If not provided, defaults will be provided.
--   
--   Since 1.0.2
tlsClientTLSSettings :: TLSClientConfig -> TLSSettings

-- | Socks configuration; default is Nothing. If absent, Socks
--   will not be used.
--   
--   Since 1.0.2
tlsClientSockSettings :: TLSClientConfig -> Maybe SockSettings

-- | 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
tlsClientConnectionContext :: TLSClientConfig -> Maybe ConnectionContext

-- | Read from a Connection.
sourceConnection :: forall (m :: Type -> Type) i. MonadIO m => Connection -> ConduitT i ByteString m ()

-- | Write to a Connection.
sinkConnection :: forall (m :: Type -> Type) o. MonadIO m => Connection -> ConduitT ByteString o m ()
