Documentation ¶
Overview ¶
Package ratelimit is an adaptive rate limit library, support for use in gin middleware and grpc interceptors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrLimitExceed is returned when the rate limiter is // triggered and the request is rejected due to limit exceeded. ErrLimitExceed = errors.New("rate limit exceeded") )
Functions ¶
This section is empty.
Types ¶
type BBR ¶
type BBR struct {
// contains filtered or unexported fields
}
BBR implements bbr-like limiter. It is inspired by sentinel. https://github.com/alibaba/Sentinel/wiki/%E7%B3%BB%E7%BB%9F%E8%87%AA%E9%80%82%E5%BA%94%E9%99%90%E6%B5%81
type Option ¶
type Option func(*options)
Option function for bbr limiter
func WithCPUQuota ¶
WithCPUQuota with real cpu quota(if it can not collect from process correct);
func WithCPUThreshold ¶
WithCPUThreshold with cpu threshold;
Click to show internal directories.
Click to hide internal directories.