src/reroute.js
function enableRerouting() {
  if (enabled)
    return;
  enabled = true;

  const connect = Net.Socket.prototype.connect;
  Net.Socket.prototype.connect = function(options, callback) {
    const hasNormalizedArgs = Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(options).length > 0;
    const isNode8           = Array.isArray(options) && hasNormalizedArgs;
    if (isNode8) {
      const reroutedOptions = rerouteOptions(options[0]);
      callback              = options[1];
      return connect.call(this, reroutedOptions, callback);
    } else if (typeof options === 'object') {
      const reroutedOptions = rerouteOptions(options);
      return connect.call(this, reroutedOptions, callback);
    } else
      return connect.apply(this, arguments);
  };
}
function enableRerouting() {
  if (enabled)
    return;
  enabled = true;

  const connect = Net.Socket.prototype.connect;
  Net.Socket.prototype.connect = function(options, callback) {
    const hasNormalizedArgs = Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(options).length > 0;
    const isNode8           = Array.isArray(options) && hasNormalizedArgs;
    if (isNode8) {
      const reroutedOptions = rerouteOptions(options[0]);
      callback              = options[1];
      return connect.call(this, reroutedOptions, callback);
    } else if (typeof options === 'object') {
      const reroutedOptions = rerouteOptions(options);
      return connect.call(this, reroutedOptions, callback);
    } else
      return connect.apply(this, arguments);
  };
}
function enableRerouting ( ) { if ( enabled ) return ; enabled = true ; const connect = Net . Socket . prototype . connect ; Net . Socket . prototype . connect = function ( options , callback ) { const hasNormalizedArgs = Object . getOwnPropertySymbols && Object . getOwnPropertySymbols ( options ) . length > 0 ; const isNode8 = Array . isArray ( options ) && hasNormalizedArgs ; if ( isNode8 ) { const reroutedOptions = rerouteOptions ( options [ 0 ] ) ; callback = options [ 1 ] ; return connect . call ( this , reroutedOptions , callback ) ; } else if ( typeof options === 'object' ) { const reroutedOptions = rerouteOptions ( options ) ; return connect . call ( this , reroutedOptions , callback ) ; } else return connect . apply ( this , arguments ) ; } ; }
Called once to hack Socket.connect
Called once to hack Socket . connect