mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
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:
parent
c3ed292d17
commit
a2a53cb728
16 changed files with 10 additions and 663 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue