package tls
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=24d5f7200ceb526bc8d1513c72dbe641a15012d3b0bba3387b85aaee9e052317
sha512=c0e246c3e5e81cb8ba6f171869694d83ae948757098b144009c7e357b3deb722b42393270a20434f1d2c82769ff519c64aa6374c471b04c38d39a5729bf60a21
doc/tls.lwt/Tls_lwt/Unix/index.html
Module Tls_lwt.Unix
Low-level API
Unix API
It is the responsibility of the client to handle error conditions. The underlying file descriptors are not closed.
Constructors
val server_of_fd :
?trace:tracer ->
Tls.Config.server ->
Lwt_unix.file_descr ->
t Lwt.tserver_of_fd ?tracer server fd is t, after server-side TLS handshake of fd using server configuration.
val client_of_fd :
?trace:tracer ->
Tls.Config.client ->
?host:string ->
Lwt_unix.file_descr ->
t Lwt.tclient_of_fd ?tracer client ~host fd is t, after client-side TLS handshake of fd using client configuration and host.
val accept :
?trace:tracer ->
Tls.Config.server ->
Lwt_unix.file_descr ->
(t * Lwt_unix.sockaddr) Lwt.taccept ?tracer server fd is t, sockaddr, after accepting a client on fd and upgrading to a TLS connection.
connect ?tracer client (host, port) is t, after successful connection to host on port and TLS upgrade.
Common stream operations
read t buffer is length, the number of bytes read into buffer.
val read_bytes : t -> Lwt_bytes.t -> int -> int -> int Lwt.tread_bytes t bytes offset len is read_bytes, the amount of bytes read.
val write_bytes : t -> Lwt_bytes.t -> int -> int -> unit Lwt.twrite_bytes t bytes offset length writes length bytes of bytes starting at offset to the session.
close t closes the TLS session by sending a close notify to the peer.
val reneg :
?authenticator:X509.Authenticator.t ->
?acceptable_cas:X509.Distinguished_name.t list ->
?cert:Tls.Config.own_cert ->
?drop:bool ->
t ->
unit Lwt.treneg ~authenticator ~acceptable_cas ~cert ~drop t renegotiates the session, and blocks until the renegotiation finished. Optionally, a new authenticator and acceptable_cas can be used. The own certificate can be adjusted by cert. If drop is true (the default), application data received before the renegotiation finished is dropped.
val epoch : t -> [ `Ok of Tls.Core.epoch_data | `Error ]epoch t returns epoch, which contains information of the active session.