本页还没有译文
本页 9 段还没译成日本語,下面显示的是英文原文。tls
还没翻译译自英文(developers.cloudflare.com)本页 9 段都还没译
Note
For compatibility dates of 2026-08-04 or later, Workers enables both nodejs_compat and nodejs_compat_v2 by default. These flags are not used for these compatibility dates. Existing projects do not need to remove them when updating their compatibility date. For earlier dates, add nodejs_compat to your Wrangler configuration file to opt in. For instructions to turn off Node.js compatibility, refer to the Node.js compatibility flag.
You can use node:tls to create secure connections to
external services using TLS (Transport Layer Security).
import { connect } from "node:tls";
// ... in a request handler ...
const connectionOptions = { key: env.KEY, cert: env.CERT };
const socket = connect(url, connectionOptions, () => {
if (socket.authorized) {
console.log("Connection authorized");
}
});
socket.on("data", (data) => {
console.log(data);
});
socket.on("end", () => {
console.log("server ends connection");
});The following APIs are available:
All other APIs, including tls.Server and tls.createServer,
are not supported and will throw a Not implemented error when called.
The full node:tls API is documented in the Node.js documentation for node:tls.