code: func NewRateLimiter(config LimiterConfig) (*RateLimiter, error) {
  	limiter := RateLimiter{
  		Mutex: &sync.Mutex{},
  	}
  
  	ipExtractor, err := utils.NewExtractor("client.ip")
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  
  	limiter.rates = ratelimit.NewRateSet()
  	for _, rate := range config.Rates {
  		err := limiter.rates.Add(rate.Period, rate.Average, rate.Burst)
  		if err != nil {
  			return nil, trace.Wrap(err)
  		}
  	}
  	if len(config.Rates) == 0 {
  		err := limiter.rates.Add(time.Second, DefaultRate, DefaultRate)
  		if err != nil {
  			return nil, trace.Wrap(err)
  		}
  	}
  
  	if config.Clock == nil {
  		config.Clock = &timetools.RealTime{}
  	}
  	limiter.clock = config.Clock
  
  	limiter.TokenLimiter, err = ratelimit.New(nil, ipExtractor,
  		limiter.rates, ratelimit.Clock(config.Clock))
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  
  	maxNumberOfUsers := config.MaxNumberOfUsers
  	if maxNumberOfUsers <= 0 {
  		maxNumberOfUsers = DefaultMaxNumberOfUsers
  	}
  	limiter.rateLimits, err = ttlmap.NewMap(
  		maxNumberOfUsers, ttlmap.Clock(config.Clock))
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  
  	return &limiter, nil
  }
docs: // NewRateLimiter returns new request rate controller