Documentation ¶
Overview ¶
Package limiter is to control the links that go into the dispatcher
Index ¶
- type GlobalDeviceLimitConfig
- type InboundInfo
- type Limiter
- func (l *Limiter) AddInboundLimiter(tag string, nodeSpeedLimit uint64, userList *[]api.UserInfo, ...) error
- func (l *Limiter) DeleteInboundLimiter(tag string) error
- func (l *Limiter) GetOnlineDevice(tag string) (*[]api.OnlineUser, error)
- func (l *Limiter) GetUserBucket(tag string, email string, ip string, isSourceTCP bool) (limiter *rate.Limiter, SpeedLimit bool, Reject bool)
- func (l *Limiter) RateWriter(writer buf.Writer, limiter *rate.Limiter) buf.Writer
- func (l *Limiter) UpdateInboundLimiter(tag string, updatedUserList *[]api.UserInfo) error
- type UserInfo
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GlobalDeviceLimitConfig ¶
type GlobalDeviceLimitConfig struct { Enable bool `mapstructure:"Enable"` RedisNetwork string `mapstructure:"RedisNetwork"` // tcp or unix RedisAddr string `mapstructure:"RedisAddr"` // host:port, or /path/to/unix.sock RedisUsername string `mapstructure:"RedisUsername"` RedisPassword string `mapstructure:"RedisPassword"` RedisDB int `mapstructure:"RedisDB"` Timeout int `mapstructure:"Timeout"` Expiry int `mapstructure:"Expiry"` // second }
type InboundInfo ¶
type InboundInfo struct { Tag string NodeSpeedLimit uint64 UserInfo *sync.Map // Key: Email value: UserInfo BucketHub *sync.Map // key: Email, value: *rate.Limiter UserOnlineIP *sync.Map // Key: Email, value: {Key: IP, value: UID} GlobalLimit struct { // contains filtered or unexported fields } AliveList map[int]int // Key: Uid, value: alive_ip OldUserOnline map[string]int // Key: Ip, value: Uid }
type Limiter ¶
func (*Limiter) AddInboundLimiter ¶
func (*Limiter) DeleteInboundLimiter ¶
func (*Limiter) GetOnlineDevice ¶
func (l *Limiter) GetOnlineDevice(tag string) (*[]api.OnlineUser, error)
func (*Limiter) GetUserBucket ¶
func (*Limiter) RateWriter ¶
Click to show internal directories.
Click to hide internal directories.