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) (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"` RedisAddr string `mapstructure:"RedisAddr"` // host:port RedisPassword string `mapstructure:"RedisPassword"` RedisDB int `mapstructure:"RedisDB"` Timeout int `mapstructure:"Timeout"` Expiry int `mapstructure:"Expiry"` // second }
type InboundInfo ¶
type Limiter ¶
type Limiter struct { InboundInfo *sync.Map // Key: Tag, Value: *InboundInfo // contains filtered or unexported fields }
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.