Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogHandler ¶
func LogHandler(config *model.LoggerConfig) slog.Handler
LogHandler returns the application log handler with the configured level.
Types ¶
type IPRateLimiter ¶
IPRateLimiter represents a rate limiter based on an IP address.
func NewIPRateLimiter ¶
func NewIPRateLimiter(tps rate.Limit, size int) *IPRateLimiter
NewIPRateLimiter returns a new IPRateLimiter.
func (*IPRateLimiter) AddLimiter ¶
func (ipLimiter *IPRateLimiter) AddLimiter(ipAddr string) *rate.Limiter
AddLimiter creates a new rate limiter and adds it to the limiters map, using the IP address as the key.
func (*IPRateLimiter) GetLimiter ¶
func (ipLimiter *IPRateLimiter) GetLimiter(ipAddr string) *rate.Limiter
GetLimiter returns the rate limiter for the provided IP address if it exists. Otherwise calls AddLimiter to add a new limiter to the map.
Click to show internal directories.
Click to hide internal directories.