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:
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 netSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
addr | SocketAddr |
cfg | TlsConfig = TlsConfig{} |
timeout | Duration? = none |
Returns
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