Module Tls_wrapper.Make

Make an Endpoint from an Underlying.flow, using TLS if appropriate.

Parameters

module Underlying : Mirage_flow.S

Signature

val connect_as_server : switch:Lwt_switch.t -> Underlying.flow -> Auth.Secret_key.t option -> (Endpoint.t, [> `Msg of string ]) Stdlib.result Lwt.t
val connect_as_client : switch:Lwt_switch.t -> Underlying.flow -> Auth.Secret_key.t Stdlib.Lazy.t -> Auth.Digest.t -> (Endpoint.t, [> `Msg of string ]) Stdlib.result Lwt.t

connect_as_client ~switch underlying key digest is an endpoint using flow underlying. If digest requires TLS, it performs a TLS handshake. It uses key as its private key and checks that the server is the one required by auth.