module TLS
TLS: require "tls". A TLSSocket is a TLS connection over a
TCPSocket, through rustls, a client's or a server's; TLS::Config
says what a client trusts and offers, TLS::ServerConfig what a server
presents and offers. Reads, writes and the handshake suspend only the calling task,
as a socket's do, and a TLSSocket is Shareable as every IO: one
write call goes out whole (in records of its own), one read call takes
a whole unit.
Classes and modules
TLS::CertificateErrorA peer certificate refused: the message names the reason (unknown issuer, name mismatch, expired).TLS::ConfigWhat a client connection trusts and offers. Immutable, so one config serves any number of connections and tasks; the configuration built from it is kept, so connecting again does not read the roots again.TLS::ErrorA TLS failure: a handshake the peer refused, a protocol error.TLS::RootsThe certificates trusted as roots.TLS::ServerConfigWhat a server presents and offers: its certificate chain and private key (PEM), the protocols it accepts by ALPN, the oldest version. Immutable, so one config serves any number of connections and tasks; the configuration built from it is kept, with its cache of sessions to resume (rustls's default). Client certificates, OCSP stapling and settings for resumption are not supported yet.