Versions in this module Expand all Collapse all v1 v1.1.1 Feb 22, 2024 Changes in this version + func ClearOnlineIP() error + func DeleteLimiter(tag string) + func Init() + type ConnLimiter struct + func NewConnLimiter(conn int, ip int, realtime bool) *ConnLimiter + func (c *ConnLimiter) AddConnCount(user string, ip string, isTcp bool) (limit bool) + func (c *ConnLimiter) ClearOnlineIP() + func (c *ConnLimiter) DelConnCount(user string, ip string) + type Limiter struct + ConnLimiter *ConnLimiter + DomainRules []*regexp.Regexp + ProtocolRules []string + SpeedLimit int + SpeedLimiter *sync.Map + UUIDtoUID map[string]int + UserLimitInfo *sync.Map + UserOnlineIP *sync.Map + func AddLimiter(tag string, l *conf.LimitConfig, users []panel.UserInfo) *Limiter + func GetLimiter(tag string) (info *Limiter, err error) + 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) GetOnlineDevice() (*[]panel.OnlineUser, error) + func (l *Limiter) UpdateDynamicSpeedLimit(tag, uuid string, limit int, expire time.Time) error + func (l *Limiter) UpdateRule(rule *panel.Rules) error + func (l *Limiter) UpdateUser(tag string, added []panel.UserInfo, deleted []panel.UserInfo) + type UserIpList struct + IpList []string + Uid int + type UserLimitInfo struct + DynamicSpeedLimit int + ExpireTime int64 + SpeedLimit int + UID int