1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-29 02:29:06 -05:00
denoland-deno/cli/js/ops/tls.ts

79 lines
1.5 KiB
TypeScript
Raw Normal View History

// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { sendAsync, sendSync } from "./dispatch_json.ts";
export interface ConnectTLSRequest {
transport: "tcp";
hostname: string;
port: number;
certFile?: string;
}
2020-04-18 11:21:20 -04:00
interface EstablishTLSResponse {
rid: number;
localAddr: {
hostname: string;
port: number;
transport: "tcp";
};
remoteAddr: {
hostname: string;
port: number;
transport: "tcp";
};
}
export function connectTls(
args: ConnectTLSRequest
2020-04-18 11:21:20 -04:00
): Promise<EstablishTLSResponse> {
return sendAsync("op_connect_tls", args);
}
interface AcceptTLSResponse {
rid: number;
localAddr: {
hostname: string;
port: number;
transport: "tcp";
};
remoteAddr: {
hostname: string;
port: number;
transport: "tcp";
};
}
2020-03-20 09:38:34 -04:00
export function acceptTLS(rid: number): Promise<AcceptTLSResponse> {
return sendAsync("op_accept_tls", { rid });
}
export interface ListenTLSRequest {
port: number;
hostname: string;
transport: "tcp";
certFile: string;
keyFile: string;
}
interface ListenTLSResponse {
rid: number;
localAddr: {
hostname: string;
port: number;
transport: "tcp";
};
}
export function listenTls(args: ListenTLSRequest): ListenTLSResponse {
return sendSync("op_listen_tls", args);
}
2020-04-18 11:21:20 -04:00
export interface StartTLSRequest {
rid: number;
hostname: string;
certFile?: string;
}
export function startTls(args: StartTLSRequest): Promise<EstablishTLSResponse> {
2020-04-18 11:21:20 -04:00
return sendAsync("op_start_tls", args);
}