lib/RemoteSlave.js
/**
   * Spawns an initializes the remote slave process.
   * @override
   * @param {String} loc The location of the remote master proxy server.
   * @param {Object} options Options to fork the slave with.
   * @param {Array<String>} args Arguments to fork the slave with.
   * @return {RemoteSlave} A self reference to the current slave instance.
   */
Spawns an initializes the remote slave process.
@override
@param {String} loc The location of the remote master proxy server.
@param {Object} options Options to fork the slave with.
@param {Array} args Arguments to fork the slave with.
@return {RemoteSlave} A self reference to the current slave instance.
Spawns an initializes the remote slave process . @override @param { String } loc The location of the remote master proxy server . @param { Object } options Options to fork the slave with . @param { Array } args Arguments to fork the slave with . @return { RemoteSlave } A self reference to the current slave instance .
initProcess(loc, options, args) {
    this.initProtected(options);
    const location = loc.match(REMOTE_CONNECTION_REGEXP);
    this[remoteslave].protocol = location[1];
    this[remoteslave].username = location[2];
    this[remoteslave].pass = location[3];
    this[remoteslave].host = location[4];
    this[remoteslave].port = location[5] || 80;
    this[remoteslave].connectionString = `${location[1]}://${location[4]}:${location[5]}`;
    this[this[remoteslave].protected].process = new PseduoChildProcess(this);
    const socketOptions = {
      reconnectionAttempts: RECONNECTION_ATTEMPTS,
      reconnectionDelay: RECONNECTION_DELAY,
      timeout: 1000,
    };
    if (this[remoteslave].username && this[remoteslave].pass) {
      const authString = `${this[remoteslave].username}:${this[remoteslave].pass}`;
      if (this[remoteslave].passphrase) {
        const cipher = crypto.createCipher('aes256', this[remoteslave].passphrase);
        let encrypted = cipher.update(authString, 'utf8', 'base64');
        encrypted += cipher.final('base64');
        socketOptions.extraHeaders = { authorization: `${encrypted}` };
      } else {
        socketOptions.extraHeaders = { authorization: `${new Buffer(authString).toString('base64')}` };
      }
    }
    this[remoteslave].socket = io(this[remoteslave].connectionString, socketOptions);
    initializeSlaveEventsWithSlaveAndPseudoChildProcess(this, args, this[remoteslave].socket, options);
    return this;
  }
initProcess ( loc , options , args ) { this . initProtected ( options ) ; const location = loc . match ( REMOTE_CONNECTION_REGEXP ) ; this [ remoteslave ] . protocol = location [ 1 ] ; this [ remoteslave ] . username = location [ 2 ] ; this [ remoteslave ] . pass = location [ 3 ] ; this [ remoteslave ] . host = location [ 4 ] ; this [ remoteslave ] . port = location [ 5 ] || 80 ; this [ remoteslave ] . connectionString = ` ${ location [ 1 ] } ${ location [ 4 ] } ${ location [ 5 ] } ` ; this [ this [ remoteslave ] . protected ] . process = new PseduoChildProcess ( this ) ; const socketOptions = { reconnectionAttempts : RECONNECTION_ATTEMPTS , reconnectionDelay : RECONNECTION_DELAY , timeout : 1000 , } ; if ( this [ remoteslave ] . username && this [ remoteslave ] . pass ) { const authString = ` ${ this [ remoteslave ] . username } ${ this [ remoteslave ] . pass } ` ; if ( this [ remoteslave ] . passphrase ) { const cipher = crypto . createCipher ( 'aes256' , this [ remoteslave ] . passphrase ) ; let encrypted = cipher . update ( authString , 'utf8' , 'base64' ) ; encrypted += cipher . final ( 'base64' ) ; socketOptions . extraHeaders = { authorization : ` ${ encrypted } ` } ; } else { socketOptions . extraHeaders = { authorization : ` ${ new Buffer ( authString ) . toString ( 'base64' ) } ` } ; } } this [ remoteslave ] . socket = io ( this [ remoteslave ] . connectionString , socketOptions ) ; initializeSlaveEventsWithSlaveAndPseudoChildProcess ( this , args , this [ remoteslave ] . socket , options ) ; return this ; }
Spawns an initializes the remote slave process.
Spawns an initializes the remote slave process .