mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-12 15:21:09 +00:00
feat(rate-limit): add user critical rate limit middleware for access token and aff transfer routes
This commit is contained in:
@@ -178,6 +178,17 @@ func CriticalRateLimit() func(c *gin.Context) {
|
||||
return defNext
|
||||
}
|
||||
|
||||
func UserCriticalRateLimit(scope string) func(c *gin.Context) {
|
||||
if !common.CriticalRateLimitEnable {
|
||||
return defNext
|
||||
}
|
||||
return userRateLimitFactory(
|
||||
common.CriticalRateLimitNum,
|
||||
common.CriticalRateLimitDuration,
|
||||
"UC:"+scope,
|
||||
)
|
||||
}
|
||||
|
||||
func DownloadRateLimit() func(c *gin.Context) {
|
||||
return rateLimitFactory(common.DownloadRateLimitNum, common.DownloadRateLimitDuration, "DW")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user