summaryrefslogtreecommitdiff
path: root/cli/js/tls.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-03-10 00:22:15 +0100
committerGitHub <noreply@github.com>2020-03-10 00:22:15 +0100
commitb7eb241c3569ead990d28b4f4889c2c52fc7894c (patch)
treef944f3c74741f3b61edae51a796471751ace7b76 /cli/js/tls.ts
parent2115b38fef654c2d7c5998f40967fcfe39d7c515 (diff)
reorg: move JS ops implementations to cli/js/ops/, part 3 (#4302)
Following JS ops were moved to separate files in cli/js/ops directory: - net - tls - fs
Diffstat (limited to 'cli/js/tls.ts')
-rw-r--r--cli/js/tls.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/js/tls.ts b/cli/js/tls.ts
index 98a6586bb..8fff562d2 100644
--- a/cli/js/tls.ts
+++ b/cli/js/tls.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { sendAsync, sendSync } from "./ops/dispatch_json.ts";
+import * as tlsOps from "./ops/tls.ts";
import { Listener, Transport, Conn, ConnImpl, ListenerImpl } from "./net.ts";
// TODO(ry) There are many configuration options to add...
@@ -17,13 +17,13 @@ const connectTLSDefaults = { hostname: "127.0.0.1", transport: "tcp" };
*/
export async function connectTLS(options: ConnectTLSOptions): Promise<Conn> {
options = Object.assign(connectTLSDefaults, options);
- const res = await sendAsync("op_connect_tls", options);
+ const res = await tlsOps.connectTLS(options as tlsOps.ConnectTLSRequest);
return new ConnImpl(res.rid, res.remoteAddr!, res.localAddr!);
}
class TLSListenerImpl extends ListenerImpl {
async accept(): Promise<Conn> {
- const res = await sendAsync("op_accept_tls", { rid: this.rid });
+ const res = await tlsOps.acceptTLS(this.rid);
return new ConnImpl(res.rid, res.remoteAddr, res.localAddr);
}
}
@@ -52,7 +52,7 @@ export interface ListenTLSOptions {
export function listenTLS(options: ListenTLSOptions): Listener {
const hostname = options.hostname || "0.0.0.0";
const transport = options.transport || "tcp";
- const res = sendSync("op_listen_tls", {
+ const res = tlsOps.listenTLS({
hostname,
port: options.port,
transport,