package middleware import ( "cc/web/util/response" "time" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/limiter" ) func Limiter() func(*fiber.Ctx) error { return limiter.New(limiter.Config{ Max: 1, Expiration: time.Second, LimitReached: func(c *fiber.Ctx) error { return response.Error(c, response.TooManyRequests, "请求过多") }, }) }