OxL Справочник OxL
РусскийEnglish

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✓ проверяется в 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

С версии. 1.0.0-beta

Параметры

ИмяТип
addrSocketAddr
cfgTlsConfig = TlsConfig{}
timeoutDuration? = none

Возвращает

TlsStream

Ошибки

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

Эффекты

net

Определено в: std/net/tls.oxl:219

См. также