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 netС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
addr | SocketAddr |
cfg | TlsConfig = TlsConfig{} |
timeout | Duration? = none |
Возвращает
Ошибки
NetError- `Unavailable`, `Timeout`, and `ProtocolError` whose message starts with `tls handshake:`, `tls certificate:`, `tls hostname:` or `tls pin:`.
Эффекты
net
Определено в: std/net/tls.oxl:219