Deno.connectTls (options: ConnectTlsOptions): Promise<Conn>
使用可选的证书文件,主机名(默认为“ 127.0.0.1”)和端口在TLS(传输层安全性)上建立安全连接。
cert文件是可选的,如果未包含,则将使用Mozilla的根证书(有关详细信息,另请参见https://github.com/ctz/webpki-roots)
原文: Establishes a secure connection over TLS (transport layer security) using an optional cert file, hostname (default is "127.0.0.1") and port. The cert file is optional and if not included Mozilla's root certificates will be used (see also https://github.com/ctz/webpki-roots for specifics)
port : number
hostname? : string (默认值:127.0.0.1)
certFile? : string
原文:
port : number (The port to connect to.)
hostname? : string (A literal IP address or host name that can be resolved to an IP address. If not specified, defaults to 127.0.0.1.)
certFile? : string
Promise<Conn>
原文: Promise<Conn>
const conn1 = await Deno.connectTls({ port: 80 });
const conn2 = await Deno.connectTls({ certFile: "./certs/my_custom_root_CA.pem", hostname: "192.0.2.1", port: 80 });
const conn3 = await Deno.connectTls({ hostname: "[2001:db8::1]", port: 80 });
const conn4 = await Deno.connectTls({ certFile: "./certs/my_custom_root_CA.pem", hostname: "golang.org", port: 80});
需要提供 allow-net 权限。
Requires allow-net permission for "tcp".