limiter

package
v1.1.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter struct {
	NodeType      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
}

func (*Limiter) CheckLimit

func (l *Limiter) CheckLimit(taguuid string, ip string, noUDPSource bool) (Bucket *ratelimit.Bucket, Reject bool)

func (*Limiter) GetOnlineDevice

func (l *Limiter) GetOnlineDevice() (*[]panel.OnlineUser, error)

func (*Limiter) UpdateUser

func (l *Limiter) UpdateUser(tag string, added []panel.UserInfo, deleted []panel.UserInfo)

type Manager added in v1.1.4

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager added in v1.1.4

func NewManager() *Manager

func (*Manager) Add added in v1.1.4

func (m *Manager) Add(tag string, users []panel.UserInfo, aliveList map[int]int, nodeType string) *Limiter

func (*Manager) Delete added in v1.1.4

func (m *Manager) Delete(tag string)

func (*Manager) Get added in v1.1.4

func (m *Manager) Get(tag string) (info *Limiter, err error)

type UserIpList

type UserIpList struct {
	Uid    int      `json:"Uid"`
	IpList []string `json:"Ips"`
}

type UserLimitInfo

type UserLimitInfo struct {
	UID               int
	SpeedLimit        int
	DeviceLimit       int
	DynamicSpeedLimit int
	ExpireTime        int64
	OverLimit         bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL