acceptAsServer(offers) {
        const opts = this._options;
        const accepted = offers.find((params)=>{
            if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === 'number' && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === 'number' && !params.client_max_window_bits) return false;
            return true;
        });
        if (!accepted) throw new Error('None of the extension offers can be accepted');
        if (opts.serverNoContextTakeover) accepted.server_no_context_takeover = true;
        if (opts.clientNoContextTakeover) accepted.client_no_context_takeover = true;
        if (typeof opts.serverMaxWindowBits === 'number') accepted.server_max_window_bits = opts.serverMaxWindowBits;
        if (typeof opts.clientMaxWindowBits === 'number') accepted.client_max_window_bits = opts.clientMaxWindowBits;
        else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) delete accepted.client_max_window_bits;
        return accepted;
    }
/**
   *  Accept an extension negotiation offer.
   *
   * @param {Array} offers The extension negotiation offers
   * @return {Object} Accepted configuration
   * @private
   */
Accept an extension negotiation offer.
@param {Array} offers The extension negotiation offers
@return {Object} Accepted configuration
@private
Accept an extension negotiation offer . @param { Array } offers The extension negotiation offers @return { Object } Accepted configuration @private
acceptAsServer(offers) {
        const opts = this._options;
        const accepted = offers.find((params)=>{
            if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === 'number' && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === 'number' && !params.client_max_window_bits) return false;
            return true;
        });
        if (!accepted) throw new Error('None of the extension offers can be accepted');
        if (opts.serverNoContextTakeover) accepted.server_no_context_takeover = true;
        if (opts.clientNoContextTakeover) accepted.client_no_context_takeover = true;
        if (typeof opts.serverMaxWindowBits === 'number') accepted.server_max_window_bits = opts.serverMaxWindowBits;
        if (typeof opts.clientMaxWindowBits === 'number') accepted.client_max_window_bits = opts.clientMaxWindowBits;
        else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) delete accepted.client_max_window_bits;
        return accepted;
    }
acceptAsServer ( offers ) { const opts = this . _options ; const accepted = offers . find ( ( params ) => { if ( opts . serverNoContextTakeover === false && params . server_no_context_takeover || params . server_max_window_bits && ( opts . serverMaxWindowBits === false || typeof opts . serverMaxWindowBits === 'number' && opts . serverMaxWindowBits > params . server_max_window_bits ) || typeof opts . clientMaxWindowBits === 'number' && ! params . client_max_window_bits ) return false ; return true ; } ) ; if ( ! accepted ) throw new Error ( 'None of the extension offers can be accepted' ) ; if ( opts . serverNoContextTakeover ) accepted . server_no_context_takeover = true ; if ( opts . clientNoContextTakeover ) accepted . client_no_context_takeover = true ; if ( typeof opts . serverMaxWindowBits === 'number' ) accepted . server_max_window_bits = opts . serverMaxWindowBits ; if ( typeof opts . clientMaxWindowBits === 'number' ) accepted . client_max_window_bits = opts . clientMaxWindowBits ; else if ( accepted . client_max_window_bits === true || opts . clientMaxWindowBits === false ) delete accepted . client_max_window_bits ; return accepted ; }
Accept an extension negotiation offer.
Accept an extension negotiation offer .