package async_ssl

  1. Overview
  2. Docs
module Connection = Ssl.Connection
val listen : ?max_connections:int -> ?backlog:int -> ?buffer_age_limit:Async.Writer.buffer_age_limit -> Config.Server.t -> ('socket, 'addr) Async.Tcp.Where_to_listen.t -> on_handler_error:[ `Call of 'socket -> exn -> unit | `Ignore | `Raise ] -> f: ('socket -> Connection.t -> Async.Reader.t -> Async.Writer.t -> unit Async.Deferred.t) -> ('socket, 'addr) Async.Tcp.Server.t Async.Deferred.t

Accept TCP connections, do a TLS negotiation on each connection and call f with the encrypted channel.

The connection is shutdown cleanly when f returns.

val wrap_server_connection : Config.Server.t -> Async.Reader.t -> Async.Writer.t -> f:(Connection.t -> Async.Reader.t -> Async.Writer.t -> 'res Async.Deferred.t) -> 'res Async.Deferred.t

Wrap a provided reader/writer pair. f will be called with the application end Reader/Writer.

Once f returns we flush and close the TLS connection and wrap_serve_connection returns.

This is for use by protocols that do dynamic TLS upgrade (e.g. SMTP and XMPP)

val with_connection : ?interrupt:unit Async.Deferred.t -> ?timeout:Core.Time_ns.Span.t -> Config.Client.t -> 'socket Async.Tcp.Where_to_connect.t -> f: (([ `Active ], 'socket) Async.Socket.t -> Connection.t -> Async.Reader.t -> Async.Writer.t -> 'res Async.Deferred.t) -> 'res Async.Deferred.t

Establish a TCP connection to a TLS server and call f with the encrypted channel.

The connection is shutdown cleanly when f returns.

val wrap_client_connection : ?timeout:Core.Time_ns.Span.t -> Config.Client.t -> Async.Reader.t -> Async.Writer.t -> f:(Connection.t -> Async.Reader.t -> Async.Writer.t -> 'res Async.Deferred.t) -> 'res Async.Deferred.t

Wrap a provided reader/writer pair. f will be called with the application end Reader/Writer. Once f returns we flush and close the TLS connection and wrap_client_connection returns.

This is for use by protocols that do dynamic TLS upgrade (e.g. SMTP and XMPP)

module Expert : sig ... end
module For_testing : sig ... end
OCaml

Innovation. Community. Security.