|
|
|
@ -107,12 +107,12 @@ tls con = fmap join -- We can have Left values both from exceptions and the |
|
|
|
modify (\s -> s{streamConnectionState = Secured}) |
|
|
|
modify (\s -> s{streamConnectionState = Secured}) |
|
|
|
return () |
|
|
|
return () |
|
|
|
|
|
|
|
|
|
|
|
client :: (MonadIO m, CPRG rng) => Params -> rng -> Backend -> m Context |
|
|
|
client :: (MonadIO m, CPRG rng) => ClientParams -> rng -> Backend -> m Context |
|
|
|
client params gen backend = do |
|
|
|
client params gen backend = do |
|
|
|
contextNew backend params gen |
|
|
|
contextNew backend params gen |
|
|
|
|
|
|
|
|
|
|
|
tlsinit :: (MonadIO m, MonadIO m1) => |
|
|
|
tlsinit :: (MonadIO m, MonadIO m1) => |
|
|
|
TLSParams |
|
|
|
ClientParams |
|
|
|
-> Backend |
|
|
|
-> Backend |
|
|
|
-> m ( Source m1 BS.ByteString |
|
|
|
-> m ( Source m1 BS.ByteString |
|
|
|
, Sink BS.ByteString m1 () |
|
|
|
, Sink BS.ByteString m1 () |
|
|
|
@ -164,7 +164,7 @@ mkReadBuffer recv = do |
|
|
|
-- seem to use it. |
|
|
|
-- seem to use it. |
|
|
|
connectTls :: ResolvConf -- ^ Resolv conf to use (try 'defaultResolvConf' as a |
|
|
|
connectTls :: ResolvConf -- ^ Resolv conf to use (try 'defaultResolvConf' as a |
|
|
|
-- default) |
|
|
|
-- default) |
|
|
|
-> TLSParams -- ^ TLS parameters to use when securing the connection |
|
|
|
-> ClientParams -- ^ TLS parameters to use when securing the connection |
|
|
|
-> String -- ^ Host to use when connecting (will be resolved |
|
|
|
-> String -- ^ Host to use when connecting (will be resolved |
|
|
|
-- using SRV records) |
|
|
|
-- using SRV records) |
|
|
|
-> ErrorT XmppFailure IO StreamHandle |
|
|
|
-> ErrorT XmppFailure IO StreamHandle |
|
|
|
@ -184,9 +184,7 @@ wrapExceptions :: IO a -> IO (Either XmppFailure a) |
|
|
|
wrapExceptions f = Ex.catches (liftM Right $ f) |
|
|
|
wrapExceptions f = Ex.catches (liftM Right $ f) |
|
|
|
[ Ex.Handler $ return . Left . XmppIOException |
|
|
|
[ Ex.Handler $ return . Left . XmppIOException |
|
|
|
, Ex.Handler $ wrap . XmppTlsError |
|
|
|
, Ex.Handler $ wrap . XmppTlsError |
|
|
|
, Ex.Handler $ wrap . XmppTlsConnectionNotEstablished |
|
|
|
, Ex.Handler $ wrap . XmppTlsException |
|
|
|
, Ex.Handler $ wrap . XmppTlsTerminated |
|
|
|
|
|
|
|
, Ex.Handler $ wrap . XmppTlsHandshakeFailed |
|
|
|
|
|
|
|
, Ex.Handler $ return . Left |
|
|
|
, Ex.Handler $ return . Left |
|
|
|
] |
|
|
|
] |
|
|
|
where |
|
|
|
where |
|
|
|
|