docs: function throttle(options) {
      assert.object(options, 'options');
      assert.number(options.burst, 'options.burst');
      assert.number(options.rate, 'options.rate');
  
      if (!xor(options.ip, options.xff, options.username)) {
          throw new Error('(ip ^ username ^ xff)');
      }
  
      var table = options.tokensTable ||
          new TokenTable({size: options.maxKeys});
  
      function rateLimit(req, res, next) {
          var attr;
          var burst = options.burst;
          var rate = options.rate;
  
          if (options.ip) {
              attr = req.connection.remoteAddress;
          } else if (options.xff) {
              attr = req.headers['x-forwarded-for'];
          } else if (options.username) {
              attr = req.username;
          } else {
              req.log.warn({config: options},
                  'Invalid throttle configuration');
              return (next());
          }
  
          // Before bothering with overrides, see if this request
          // even matches
          if (!attr) {
              return (next());
          }
  
          // Check the overrides
          if (options.overrides &&
              options.overrides[attr] &&
              options.overrides[attr].burst !== undefined &&
              options.overrides[attr].rate !== undefined) {
  
              burst = options.overrides[attr].burst;
              rate = options.overrides[attr].rate;
          }
  
          if (!rate || !burst) {
              return (next());
          }
  
          var bucket = table.get(attr);
  
          if (!bucket) {
              bucket = new TokenBucket({
                  capacity: burst,
                  fillRate: rate
              });
              table.put(attr, bucket);
          }
  
          req.log.trace('Throttle(%s): num_tokens= %d',
              attr, bucket.tokens);
  
          if (!bucket.consume(1)) {
              req.log.info({
                  address: req.connection.remoteAddress || '?',
                  method: req.method,
                  url: req.url,
                  user: req.username || '?'
              }, 'Throttling');
  
              var msg = sprintf(MESSAGE, rate);
              return (next(new TooManyRequestsError(msg)));
          }
  
          return (next());
      }
  
      return (rateLimit);
  }