diff options
Diffstat (limited to 'ext/net/lib.deno_net.d.ts')
-rw-r--r-- | ext/net/lib.deno_net.d.ts | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/net/lib.deno_net.d.ts b/ext/net/lib.deno_net.d.ts index 45f1194fb..1b67fcf22 100644 --- a/ext/net/lib.deno_net.d.ts +++ b/ext/net/lib.deno_net.d.ts @@ -33,6 +33,13 @@ declare namespace Deno { [Symbol.asyncIterator](): AsyncIterableIterator<Conn>; } + /** Specialized listener that accepts TLS connections. */ + export interface TlsListener extends Listener, AsyncIterable<TlsConn> { + /** Waits for a TLS client to connect and accepts the connection. */ + accept(): Promise<TlsConn>; + [Symbol.asyncIterator](): AsyncIterableIterator<TlsConn>; + } + export interface Conn extends Reader, Writer, Closer { /** The local address of the connection. */ readonly localAddr: Addr; @@ -45,6 +52,13 @@ declare namespace Deno { closeWrite(): Promise<void>; } + export interface TlsConn extends Conn { + /** Runs the client or server handshake protocol to completion if that has + * not happened yet. Calling this method is optional; the TLS handshake + * will be completed automatically as soon as data is sent or received. */ + handshake(): Promise<void>; + } + export interface ListenOptions { /** The port to listen on. */ port: number; @@ -90,7 +104,7 @@ declare namespace Deno { * ``` * * Requires `allow-net` permission. */ - export function listenTls(options: ListenTlsOptions): Listener; + export function listenTls(options: ListenTlsOptions): TlsListener; export interface ConnectOptions { /** The port to connect to. */ @@ -150,7 +164,7 @@ declare namespace Deno { * * Requires `allow-net` permission. */ - export function connectTls(options: ConnectTlsOptions): Promise<Conn>; + export function connectTls(options: ConnectTlsOptions): Promise<TlsConn>; /** Shutdown socket send operations. * |