diff options
author | 2023-01-17 12:52:49 -0800 | |
---|---|---|
committer | 2023-01-17 12:52:49 -0800 | |
commit | 25a2962186e42fe058eb2fc240d7f7fc7f3a350d (patch) | |
tree | 587b3fe5f19fd429a3ae2eacdebf71228a98e2fe | |
parent | c943dbadef6cce9d8bedad52cb77854de3952d39 (diff) | |
download | bun-25a2962186e42fe058eb2fc240d7f7fc7f3a350d.tar.gz bun-25a2962186e42fe058eb2fc240d7f7fc7f3a350d.tar.zst bun-25a2962186e42fe058eb2fc240d7f7fc7f3a350d.zip |
Expose tls.connect
-rw-r--r-- | src/bun.js/node-tls.exports.js | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/bun.js/node-tls.exports.js b/src/bun.js/node-tls.exports.js index 298fd490a..bd423a88a 100644 --- a/src/bun.js/node-tls.exports.js +++ b/src/bun.js/node-tls.exports.js @@ -111,7 +111,22 @@ export const CLIENT_RENEG_LIMIT = 3, DEFAULT_CIPHERS = "DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256", DEFAULT_MIN_VERSION = "TLSv1.2", - DEFAULT_MAX_VERSION = "TLSv1.3"; + DEFAULT_MAX_VERSION = "TLSv1.3", + createConnection = (port, host, connectListener) => { + if (typeof host == "function") { + connectListener = host; + host = undefined; + } + var options = + typeof port == "object" + ? port + : { + host: host, + port: port, + }; + return new TLSSocket(options).connect(options, connectListener); + }, + connect = createConnection; var exports = { createSecureContext, @@ -135,7 +150,16 @@ var exports = { DEFAULT_MIN_VERSION, DEFAULT_MAX_VERSION, [Symbol.for("CommonJS")]: 0, + connect, + createConnection, }; export default exports; -export { createSecureContext, parseCertString, TLSSocket, SecureContext }; +export { + createSecureContext, + parseCertString, + TLSSocket, + SecureContext, + connect, + createConnection, +}; |