hs-connection icon indicating copy to clipboard operation
hs-connection copied to clipboard

connectionInfo

Open cbm80 opened this issue 10 years ago • 0 comments

Possibly add & export a function to Network.Connection that allows the user of the library to query information about an established TLS connection. Something along the lines of (using LambdaCase)

connectionInfo :: Connection -> IO (Maybe TLS.Information)
connectionInfo c = do
    tryReadMVar (connectionBackend c) >>= \case
     Nothing -> return Nothing
     Just connBackend -> do
          case connBackend of
            ConnectionTLS ctx -> TLS.contextGetInformation ctx
            _ -> return Nothing

cbm80 avatar Sep 24 '14 14:09 cbm80