Skip to content

Commit

Permalink
tls: remove usage of public require('util')
Browse files Browse the repository at this point in the history
Remove the usage of public require('util'), as described in:
nodejs#26546

PR-URL: nodejs#26747
Refs: nodejs#26546
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
dnlup authored and BridgeAR committed Mar 24, 2019
1 parent 1ac88f4 commit a1330af
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,21 @@

'use strict';

require('internal/util').assertCrypto();
const {
assertCrypto,
deprecate
} = require('internal/util');

assertCrypto();

const assert = require('internal/assert');
const crypto = require('crypto');
const net = require('net');
const tls = require('tls');
const util = require('util');
const common = require('_tls_common');
const JSStreamSocket = require('internal/js_stream_socket');
const { Buffer } = require('buffer');
const debug = util.debuglog('tls');
const debug = require('internal/util/debuglog').debuglog('tls');
const { TCP, constants: TCPConstants } = internalBinding('tcp_wrap');
const tls_wrap = internalBinding('tls_wrap');
const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap');
Expand Down Expand Up @@ -393,7 +397,8 @@ function TLSSocket(socket, opts) {
// Read on next tick so the caller has a chance to setup listeners
process.nextTick(initRead, this, socket);
}
util.inherits(TLSSocket, net.Socket);
Object.setPrototypeOf(TLSSocket.prototype, net.Socket.prototype);
Object.setPrototypeOf(TLSSocket, net.Socket);
exports.TLSSocket = TLSSocket;

var proxiedMethods = [
Expand Down Expand Up @@ -985,7 +990,8 @@ function Server(options, listener) {
}
}

util.inherits(Server, net.Server);
Object.setPrototypeOf(Server.prototype, net.Server.prototype);
Object.setPrototypeOf(Server, net.Server);
exports.Server = Server;
exports.createServer = function createServer(options, listener) {
return new Server(options, listener);
Expand Down Expand Up @@ -1133,7 +1139,7 @@ Server.prototype.setTicketKeys = function setTicketKeys(keys) {
};


Server.prototype.setOptions = util.deprecate(function(options) {
Server.prototype.setOptions = deprecate(function(options) {
this.requestCert = options.requestCert === true;
this.rejectUnauthorized = options.rejectUnauthorized !== false;

Expand Down

0 comments on commit a1330af

Please sign in to comment.