OxL Reference

method TlsStream.connect

Connects to addr and runs the client handshake. cfg.serverName defaults to the textual address (matched against IP subject alternative names). timeout bounds the TCP connect and the handshake separately.

Example:

oxl✓ checked in CI
use std.net { TlsStream, TlsConfig, SocketAddr }

fn open(addr: SocketAddr) -> TlsStream | NetError  net {
  TlsStream.connect(addr, TlsConfig{ ca: "ca.pem", serverName: "db.internal" }, 3s)
}
pub(api) static fn connect(addr: SocketAddr, cfg: TlsConfig = TlsConfig{}, timeout: Duration? = none) -> TlsStream | NetError  net

Since. 1.0.0-beta

Parameters

NameType
addrSocketAddr
cfgTlsConfig = TlsConfig{}
timeoutDuration? = none

Returns

TlsStream

Errors

  • NetError
  • `Unavailable`, `Timeout`, and `ProtocolError` whose message starts with `tls handshake:`, `tls certificate:`, `tls hostname:` or `tls pin:`.

Effects

net

Defined in: std/net/tls.oxl:219

See also