| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Simplex.Messaging.Transport.Server
Synopsis
- data TransportServerConfig = TransportServerConfig {
- logTLSErrors :: Bool
- serverALPN :: Maybe [ALPN]
- askClientCert :: Bool
- addCORSHeaders :: Bool
- tlsSetupTimeout :: Int
- transportTimeout :: Int
- data ServerCredentials = ServerCredentials {
- caCertificateFile :: Maybe FilePath
- privateKeyFile :: FilePath
- certificateFile :: FilePath
- data TLSServerCredential = TLSServerCredential {
- credential :: Credential
- sniCredential :: Maybe Credential
- type SNICredentialUsed = Bool
- type AddHTTP = Bool
- mkTransportServerConfig :: Bool -> Maybe [ALPN] -> Bool -> TransportServerConfig
- runTransportServerState :: Transport c => SocketState -> TMVar Bool -> ServiceName -> Supported -> Credential -> TransportServerConfig -> (c 'TServer -> IO ()) -> IO ()
- runTransportServerState_ :: forall c. Transport c => SocketState -> TMVar Bool -> ServiceName -> Supported -> TLSServerCredential -> TransportServerConfig -> (Socket -> (SNICredentialUsed, c 'TServer) -> IO ()) -> IO ()
- type SocketState = (TVar Int, TVar Int, TVar (IntMap (Weak ThreadId)))
- data SocketStats = SocketStats {
- socketsAccepted :: Int
- socketsClosed :: Int
- socketsActive :: Int
- socketsLeaked :: Int
- newSocketState :: IO SocketState
- getSocketStats :: SocketState -> IO SocketStats
- runTransportServer :: Transport c => TMVar Bool -> ServiceName -> Supported -> Credential -> TransportServerConfig -> (c 'TServer -> IO ()) -> IO ()
- runTransportServerSocket :: Transport c => TMVar Bool -> IO Socket -> String -> ServerParams -> TransportServerConfig -> (c 'TServer -> IO ()) -> IO ()
- runLocalTCPServer :: TMVar Bool -> ServiceName -> (Socket -> IO ()) -> IO ()
- startTCPServer :: TMVar Bool -> Maybe HostName -> ServiceName -> IO Socket
- loadServerCredential :: ServerCredentials -> IO Credential
- loadFingerprint :: ServerCredentials -> IO Fingerprint
- loadFileFingerprint :: FilePath -> IO Fingerprint
- smpServerHandshake :: forall c. Transport c => CertificateChain -> APrivateSignKey -> c 'TServer -> KeyPairX25519 -> KeyHash -> VersionRangeSMP -> (SMPServiceRole -> CertificateChain -> Fingerprint -> ExceptT TransportError IO ServiceId) -> ExceptT TransportError IO (THandleSMP c 'TServer)
Documentation
data TransportServerConfig Source #
Constructors
| TransportServerConfig | |
Fields
| |
Instances
| Show TransportServerConfig Source # | |
Defined in Simplex.Messaging.Transport.Server Methods showsPrec :: Int -> TransportServerConfig -> ShowS show :: TransportServerConfig -> String showList :: [TransportServerConfig] -> ShowS | |
| Eq TransportServerConfig Source # | |
Defined in Simplex.Messaging.Transport.Server Methods (==) :: TransportServerConfig -> TransportServerConfig -> Bool (/=) :: TransportServerConfig -> TransportServerConfig -> Bool | |
data ServerCredentials Source #
Constructors
| ServerCredentials | |
Fields
| |
Instances
| Show ServerCredentials Source # | |
Defined in Simplex.Messaging.Transport.Server Methods showsPrec :: Int -> ServerCredentials -> ShowS show :: ServerCredentials -> String showList :: [ServerCredentials] -> ShowS | |
data TLSServerCredential Source #
Constructors
| TLSServerCredential | |
Fields
| |
type SNICredentialUsed = Bool Source #
mkTransportServerConfig :: Bool -> Maybe [ALPN] -> Bool -> TransportServerConfig Source #
runTransportServerState :: Transport c => SocketState -> TMVar Bool -> ServiceName -> Supported -> Credential -> TransportServerConfig -> (c 'TServer -> IO ()) -> IO () Source #
runTransportServerState_ :: forall c. Transport c => SocketState -> TMVar Bool -> ServiceName -> Supported -> TLSServerCredential -> TransportServerConfig -> (Socket -> (SNICredentialUsed, c 'TServer) -> IO ()) -> IO () Source #
type SocketState = (TVar Int, TVar Int, TVar (IntMap (Weak ThreadId))) Source #
data SocketStats Source #
Constructors
| SocketStats | |
Fields
| |
newSocketState :: IO SocketState Source #
getSocketStats :: SocketState -> IO SocketStats Source #
runTransportServer :: Transport c => TMVar Bool -> ServiceName -> Supported -> Credential -> TransportServerConfig -> (c 'TServer -> IO ()) -> IO () Source #
Run transport server (plain TCP or WebSockets) on passed TCP port and signal when server started and stopped via passed TMVar.
All accepted connections are passed to the passed function.
runTransportServerSocket :: Transport c => TMVar Bool -> IO Socket -> String -> ServerParams -> TransportServerConfig -> (c 'TServer -> IO ()) -> IO () Source #
Run a transport server with provided connection setup and handler.
runLocalTCPServer :: TMVar Bool -> ServiceName -> (Socket -> IO ()) -> IO () Source #
Run TCP server without TLS
startTCPServer :: TMVar Bool -> Maybe HostName -> ServiceName -> IO Socket Source #
loadServerCredential :: ServerCredentials -> IO Credential Source #
loadFingerprint :: ServerCredentials -> IO Fingerprint Source #
loadFileFingerprint :: FilePath -> IO Fingerprint Source #
smpServerHandshake :: forall c. Transport c => CertificateChain -> APrivateSignKey -> c 'TServer -> KeyPairX25519 -> KeyHash -> VersionRangeSMP -> (SMPServiceRole -> CertificateChain -> Fingerprint -> ExceptT TransportError IO ServiceId) -> ExceptT TransportError IO (THandleSMP c 'TServer) Source #
Server SMP transport handshake.
See https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#appendix-a