|
3 | 3 | require('internal/util').assertCrypto(); |
4 | 4 |
|
5 | 5 | const assert = require('assert'); |
| 6 | +const Buffer = require('buffer').Buffer; |
| 7 | +const common = require('_tls_common'); |
| 8 | +const Connection = process.binding('crypto').Connection; |
6 | 9 | const EventEmitter = require('events'); |
| 10 | +const internalUtil = require('internal/util'); |
7 | 11 | const stream = require('stream'); |
| 12 | +const Timer = process.binding('timer_wrap').Timer; |
8 | 13 | const tls = require('tls'); |
9 | 14 | const util = require('util'); |
10 | | -const common = require('_tls_common'); |
| 15 | + |
11 | 16 | const debug = util.debuglog('tls-legacy'); |
12 | | -const Buffer = require('buffer').Buffer; |
13 | | -const Timer = process.binding('timer_wrap').Timer; |
14 | | -const Connection = process.binding('crypto').Connection; |
15 | 17 |
|
16 | 18 | function SlabBuffer() { |
17 | 19 | this.create(); |
@@ -787,18 +789,11 @@ function securePairNT(self, options) { |
787 | 789 | } |
788 | 790 |
|
789 | 791 |
|
790 | | -exports.createSecurePair = function(context, |
791 | | - isServer, |
792 | | - requestCert, |
793 | | - rejectUnauthorized, |
794 | | - options) { |
795 | | - var pair = new SecurePair(context, |
796 | | - isServer, |
797 | | - requestCert, |
798 | | - rejectUnauthorized, |
799 | | - options); |
800 | | - return pair; |
801 | | -}; |
| 792 | +function createSecurePair(context, isServer, requestCert, |
| 793 | + rejectUnauthorized, options) { |
| 794 | + return new SecurePair(context, isServer, requestCert, |
| 795 | + rejectUnauthorized, options); |
| 796 | +} |
802 | 797 |
|
803 | 798 |
|
804 | 799 | SecurePair.prototype.maybeInitFinished = function() { |
@@ -868,7 +863,7 @@ SecurePair.prototype.error = function(returnOnly) { |
868 | 863 | }; |
869 | 864 |
|
870 | 865 |
|
871 | | -exports.pipe = function pipe(pair, socket) { |
| 866 | +function pipe(pair, socket) { |
872 | 867 | pair.encrypted.pipe(socket); |
873 | 868 | socket.pipe(pair.encrypted); |
874 | 869 |
|
@@ -918,7 +913,7 @@ exports.pipe = function pipe(pair, socket) { |
918 | 913 | socket.on('timeout', ontimeout); |
919 | 914 |
|
920 | 915 | return cleartext; |
921 | | -}; |
| 916 | +} |
922 | 917 |
|
923 | 918 |
|
924 | 919 | function pipeCloseNT(pair, socket) { |
@@ -927,3 +922,11 @@ function pipeCloseNT(pair, socket) { |
927 | 922 | pair.encrypted.unpipe(socket); |
928 | 923 | socket.destroySoon(); |
929 | 924 | } |
| 925 | + |
| 926 | +module.exports = { |
| 927 | + createSecurePair: |
| 928 | + internalUtil.deprecate(createSecurePair, |
| 929 | + 'tls.createSecurePair() is deprecated. Please use ' + |
| 930 | + 'tls.Socket instead.', 'DEP0064'), |
| 931 | + pipe |
| 932 | +}; |