second-transfer-0.10.0.2: Second Transfer HTTP/2 web server

Safe HaskellNone
LanguageHaskell2010

SecondTransfer.TLS.Types

Synopsis

Documentation

data FinishRequest

Singleton type. Used in conjunction with an MVar. If the MVar is full, the fuction tlsServeWithALPNAndFinishOnRequest knows that it should finish at its earliest convenience and call the CloseAction for any open sessions.

Constructors

FinishRequest 

type ProtocolSelector = [ByteString] -> IO (Maybe Int)

Callback function to select a protocol during the ALPN negotiation phase. Given a list of ALPN identifiers, if something is suitable, return it.

class IOChannels session => TLSContext ctx session | ctx -> session, session -> ctx where

Class to have different kinds of TLS backends. Included here and enabled through 'enable-botan' is support for using Botan as a backend. HTTP/2 requires TLS 1.2 and ALPN, so older versions of many TLS libraries are not suitable.

Methods

newTLSContextFromMemory :: ByteString -> ByteString -> ProtocolSelector -> IO ctx

newTLSContextFromMemory cert_data key_data protocol_selector creates a new context, provided certificate data. The certificate data must be in X509 format. The private key should be in PKCS8 format without password.

newTLSContextFromCertFileNames

Arguments

:: ByteString 
-> ByteString 
-> ProtocolSelector 
-> IO ctx

newTLSContextFromMemory cert_filename key_filename protocol_selector ^ Same as before, but using filename instead of certificates loaded into memory.

unencryptTLSServerIO :: forall cipherio. TLSServerIO cipherio => ctx -> cipherio -> IO session

Returns the protocoll finally selected for a session.

getSelectedProtocol :: session -> IO (Maybe (Int, ByteString))

newtype ConnectionId

A connection number

Constructors

ConnectionId Int64 

data ConnectionEvent

Connection events

Constructors

Established_CoEv SockAddr ConnectionId Int64

New connection. The second member says how many live connections are now

ALPNFailed_CoEv ConnectionId

An ALPN negotiation failed

Ended_CoEv ConnectionId

A connection ended.

data ConnectionCallbacks

Callbacks used by client applications to get notified about interesting events happening at a connection level, or to get asked about things (e.g, about if it is proper to accept a connection). These are used from CoreServer

Constructors

ConnectionCallbacks 

Fields

_logEvents_CoCa :: Maybe LogCallback

Invoked after the connection is accepted, and after it is finished.

defaultConnectionCallbacks :: ConnectionCallbacks

Default connections callback. Empty