← all modules
module

stdlib::net::tls

defined in C:\Users\bye45\.glide\bin/src/stdlib/net/tls.glide

Configuration for an outbound TLS connection.

struct struct TlsConfig

Configuration for an outbound TLS connection.

struct struct TlsStream
struct struct TlsListener

Server-side listener: holds the SSL_CTX with cert+key plus the underlying TCP listening socket. accept blocks for the next client and returns a TlsStream after the handshake succeeds.

fn fn tls_attach_server(conn_fd: int, cert_path: string, key_path: string) -> !*TlsStream

Server-side counterpart to TlsStream::attach: wrap an already- accepted plain Conn in TLS for protocols that promote inline (STARTTLS, FTPS-AUTH-TLS, IMAP STARTTLS, POP3 STLS).

On success the returned TlsStream owns the underlying socket; the caller MUST NOT call conn.close() afterwards.

glide
In an SMTP server, after the client sends STARTTLS:
let r: !*TlsStream = tls_attach_server(conn.fd, "cert.pem", "key.pem");
if r.ok { defer r.val.close(); /* communicate over TLS */ }