Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPRateLimiter ¶
type IPRateLimiter struct {
// contains filtered or unexported fields
}
IPRateLimiter manages rate limiters for different IPs with eviction support.
func NewIPRateLimiter ¶
func NewIPRateLimiter(r rate.Limit, b int, t itimeservice.IService) *IPRateLimiter
NewIPRateLimiter initializes a new IPRateLimiter with the given rate and burst size.
func (*IPRateLimiter) AddLimiter ¶
func (i *IPRateLimiter) AddLimiter(ip string) *rate.Limiter
AddLimiter creates a new rate limiter for the provided IP and adds it to the map.
func (*IPRateLimiter) GetLimiter ¶
func (i *IPRateLimiter) GetLimiter(ip string) *rate.Limiter
GetLimiter retrieves the rate limiter for the provided IP. If it doesn't exist, a new one is created.
type IRateLimiter ¶
type LimiterEntry ¶
type LimiterEntry struct {
// contains filtered or unexported fields
}
LimiterEntry contains the rate limiter and the last time it was accessed.
Click to show internal directories.
Click to hide internal directories.