code: func New(ctx context.Context, next http.Handler, config config.RateLimit, name string) (http.Handler, error) {
  	middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware")
  
  	extractFunc, err := utils.NewExtractor(config.ExtractorFunc)
  	if err != nil {
  		return nil, err
  	}
  
  	rateSet := ratelimit.NewRateSet()
  	for _, rate := range config.RateSet {
  		if err = rateSet.Add(time.Duration(rate.Period), rate.Average, rate.Burst); err != nil {
  			return nil, err
  		}
  	}
  
  	rl, err := ratelimit.New(next, extractFunc, rateSet)
  	if err != nil {
  		return nil, err
  	}
  	return &rateLimiter{handler: rl, name: name}, nil
  }
docs: // New creates rate limiter middleware.