Documentation
¶
Index ¶
- func DeleteLimiter(tag string)
- func Init()
- 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(taguuid string, ip string, isTcp bool, noSSUDP bool) (Bucket *ratelimit.Bucket, Reject bool)
- func (l *Limiter) CheckProtocolRule(protocol string) (reject bool)
- func (l *Limiter) GetOnlineDevice() (*[]panel.OnlineUser, error)
- func (l *Limiter) LimitedUserCount() int
- func (l *Limiter) UpdateAliveList(aliveList map[int]int)
- 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
- type UserLimitInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteLimiter ¶
func DeleteLimiter(tag string)
Types ¶
type Limiter ¶
type Limiter struct {
DomainRules []*regexp.Regexp
ProtocolRules []string
SpeedLimit int
UserOnlineIP *sync.Map // Key: TagUUID, value: {Key: Ip, value: Uid}
OldUserOnline *sync.Map // Key: Ip, value: Uid
UUIDtoUID map[string]int // Key: UUID, value: Uid
UserLimitInfo *sync.Map // Key: TagUUID value: UserLimitInfo
SpeedLimiter *sync.Map // key: TagUUID, value: *ratelimit.Bucket
AliveList map[int]int // Key: Uid, value: alive_ip
// contains filtered or unexported fields
}
func AddLimiter ¶
func GetLimiter ¶
func (*Limiter) AddDynamicSpeedLimit ¶
func (*Limiter) CheckDomainRule ¶
func (*Limiter) CheckLimit ¶
func (*Limiter) CheckProtocolRule ¶
func (*Limiter) GetOnlineDevice ¶
func (l *Limiter) GetOnlineDevice() (*[]panel.OnlineUser, error)
func (*Limiter) LimitedUserCount ¶ added in v0.8.3
LimitedUserCount walks UserLimitInfo and returns how many users currently have an active speed cap — either a static SpeedLimit or an unexpired dynamic limit. The metrics task uses this to populate the destructive "X Limit" row in the admin popup.
func (*Limiter) UpdateAliveList ¶ added in v0.9.0
func (*Limiter) UpdateDynamicSpeedLimit ¶
type UserIpList ¶
Click to show internal directories.
Click to hide internal directories.