29 lines
497 B
Go
29 lines
497 B
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type RateLimiterRequest struct {
|
|
Key string `validate:"required"`
|
|
MaxRps int `validate:"required"`
|
|
PeriodInSec int
|
|
Burst int
|
|
}
|
|
|
|
type RateLimiterInMemRequest struct {
|
|
Key string `validate:"required"`
|
|
MaxRps float64 `validate:"required"`
|
|
InfiniteKey bool
|
|
}
|
|
|
|
type RateLimiterResponse struct {
|
|
Allow bool
|
|
Remaining int
|
|
RetryAfter time.Duration
|
|
}
|
|
|
|
type RateLimiterInMemResponse struct {
|
|
PassAfter time.Duration
|
|
}
|