Documentation
¶
Index ¶
- func ClearOnlineIP() error
- func DeleteLimiter(tag string)
- func Init()
- func UpdateLimiter(tag string, added []panel.UserInfo, deleted []panel.UserInfo) error
- type ConnLimiter
- type Limiter
- func (l *Limiter) AddDynamicSpeedLimit(tag string, userInfo *panel.UserInfo, limitNum int, expire int64) error
- func (l *Limiter) CheckDomainRule(destination string) (reject bool)
- func (l *Limiter) CheckLimit(email string, ip string, isTcp bool) (Bucket *ratelimit.Bucket, Reject bool)
- func (l *Limiter) CheckProtocolRule(protocol string) (reject bool)
- func (l *Limiter) UpdateRule(newRuleList []*regexp.Regexp) error
- type UserIpList
- type UserLimitInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearOnlineIP ¶
func ClearOnlineIP() error
func DeleteLimiter ¶
func DeleteLimiter(tag string)
Types ¶
type ConnLimiter ¶
type ConnLimiter struct {
// contains filtered or unexported fields
}
func NewConnLimiter ¶
func NewConnLimiter(conn int, ip int, realtime bool) *ConnLimiter
func (*ConnLimiter) AddConnCount ¶
func (c *ConnLimiter) AddConnCount(user string, ip string, isTcp bool) (limit bool)
func (*ConnLimiter) ClearOnlineIP ¶
func (c *ConnLimiter) ClearOnlineIP()
ClearOnlineIP Clear udp,icmp and other packet protocol online ip
func (*ConnLimiter) DelConnCount ¶
func (c *ConnLimiter) DelConnCount(user string, ip string)
DelConnCount Delete tcp connection count, no tcp do not use
type Limiter ¶
type Limiter struct { Rules []*regexp.Regexp ProtocolRules []string SpeedLimit int UserLimitInfo *sync.Map // Key: Uid value: UserLimitInfo ConnLimiter *ConnLimiter // Key: Uid value: ConnLimiter SpeedLimiter *sync.Map // key: Uid, value: *ratelimit.Bucket }
func AddLimiter ¶
func GetLimiter ¶
func (*Limiter) AddDynamicSpeedLimit ¶
func (*Limiter) CheckDomainRule ¶
func (*Limiter) CheckLimit ¶
func (*Limiter) CheckProtocolRule ¶
type UserIpList ¶
Click to show internal directories.
Click to hide internal directories.