Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPLimiter ¶
type IPLimiter struct {
// contains filtered or unexported fields
}
IPLimiter 基于ip的限流
type UserLimiter ¶
type UserLimiter struct {
// contains filtered or unexported fields
}
UserLimiter 基于用户uid的限流
func NewUserLimiter ¶
func NewUserLimiter(r rate.Limit, b int) *UserLimiter
NewUserLimiter return a new user limiter
每r秒b个
func (*UserLimiter) GetLimiter ¶
func (m *UserLimiter) GetLimiter(uid int64) *rate.Limiter
Click to show internal directories.
Click to hide internal directories.