Documentation
¶
Overview ¶
Package limiter is to control the links that go into the dispatcher
Index ¶
- type IPLimit
- type InboundInfo
- type Limiter
- func (l *Limiter) AddInboundLimiter(tag string, nodeSpeedLimit uint64, serviceList *[]api.ServiceInfo, ...) error
- func (l *Limiter) DeleteInboundLimiter(tag string) error
- func (l *Limiter) GetOnlineDevice(tag string) (*[]api.OnlineIP, 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, updatedServiceList *[]api.ServiceInfo) error
- type ServiceInfo
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPLimit ¶ added in v1.0.8
type IPLimit 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
ServiceInfo *sync.Map // Key: Email value: ServiceInfo
BucketHub *sync.Map // key: Email, value: *rate.Limiter
ServiceOnlineIP *sync.Map // Key: Email, value: {Key: IP, value: UID}
GlobalIPLimit struct {
// contains filtered or unexported fields
}
}
type Limiter ¶
func (*Limiter) AddInboundLimiter ¶
func (*Limiter) DeleteInboundLimiter ¶
func (*Limiter) GetOnlineDevice ¶
func (*Limiter) GetUserBucket ¶
func (*Limiter) RateWriter ¶
func (*Limiter) UpdateInboundLimiter ¶
func (l *Limiter) UpdateInboundLimiter(tag string, updatedServiceList *[]api.ServiceInfo) error
type ServiceInfo ¶
Click to show internal directories.
Click to hide internal directories.