summaryrefslogtreecommitdiff
path: root/ext/net/lib.deno_net.d.ts
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2021-10-26 22:27:47 +0200
committerGitHub <noreply@github.com>2021-10-26 22:27:47 +0200
commitcf9c4f0031a46b58989a984af0528a2005547e2d (patch)
tree40d2a2efbc8570e0f875ce877f6f95c6d5f27be9 /ext/net/lib.deno_net.d.ts
parentc27ef0ac7b5fd7aba4de24292e80387c8243896e (diff)
feat(ext/net): add TlsConn.handshake() (#12467)
A `handshake()` method was added that returns when the TLS handshake is complete. The `TlsListener` and `TlsConn` interfaces were added to accomodate this new method. Closes: #11759.
Diffstat (limited to 'ext/net/lib.deno_net.d.ts')
-rw-r--r--ext/net/lib.deno_net.d.ts18
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.
*