tls: remove deprecated tls.createSecurePair

PR-URL: https://github.com/nodejs/node/pull/57361
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Jonas 2025-03-11 19:01:28 -04:00 committed by GitHub
parent c3ed292d17
commit a2a53cb728
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 10 additions and 663 deletions

View file

@ -2,7 +2,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
dur: [5],
securing: ['SecurePair', 'TLSSocket', 'clear'],
securing: ['TLSSocket', 'clear'],
size: [100, 1024, 1024 * 1024],
}, {
flags: ['--no-warnings'],
@ -68,9 +68,6 @@ function main({ dur, size, securing }) {
function onProxyConnection(conn) {
const client = net.connect(REDIRECT_PORT, () => {
switch (securing) {
case 'SecurePair':
securePair(conn, client);
break;
case 'TLSSocket':
secureTLSSocket(conn, client);
break;
@ -83,17 +80,6 @@ function main({ dur, size, securing }) {
});
}
function securePair(conn, client) {
const serverCtx = tls.createSecureContext(options);
const serverPair = tls.createSecurePair(serverCtx, true, true, false);
conn.pipe(serverPair.encrypted);
serverPair.encrypted.pipe(conn);
serverPair.on('error', (error) => {
throw new Error(`Pair error: ${error}`);
});
serverPair.cleartext.pipe(client);
}
function secureTLSSocket(conn, client) {
const serverSocket = new tls.TLSSocket(conn, options);
serverSocket.on('error', (e) => {