Documentation ¶
Index ¶
- Constants
- func CreateRateInfo(conf *Config) *rateInfo
- func Register(register eosc.IExtenderDriverRegister)
- type Config
- type Driver
- type Factory
- type RateLimiting
- func (r *RateLimiting) CheckSkill(skill string) bool
- func (r *RateLimiting) Destroy()
- func (r *RateLimiting) DoFilter(ctx http_service.IHttpContext, next http_service.IChain) (err error)
- func (r *RateLimiting) Id() string
- func (r *RateLimiting) Reset(conf interface{}, workers map[eosc.RequireId]interface{}) error
- func (r *RateLimiting) Start() error
- func (r *RateLimiting) Stop() error
Constants ¶
View Source
const (
Name = "rate_limiting"
)
Variables ¶
This section is empty.
Functions ¶
func CreateRateInfo ¶
func CreateRateInfo(conf *Config) *rateInfo
func Register ¶
func Register(register eosc.IExtenderDriverRegister)
Types ¶
type Config ¶
type Config struct { Second int64 `json:"second,omitempty" label:"每秒请求次数限制"` // 每秒请求次数限制 Minute int64 `json:"minute,omitempty" label:"每分钟请求次数限制"` // 每分钟请求次数限制 Hour int64 `json:"hour,omitempty" label:"每小时请求次数限制"` // 每小时请求次数限制 Day int64 `json:"day,omitempty" label:"每天请求次数限制"` // 每天请求次数限制 HideClientHeader bool `json:"hide_client_header" label:"是否隐藏流控信息"` // 请求结果是否隐藏流控信息 ResponseType string `json:"response_type" label:"报错格式" enum:"text,json"` // 插件返回报错的类型 }
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func (*Driver) ConfigType ¶
type Factory ¶
type Factory struct { }
func NewFactory ¶
func NewFactory() *Factory
type RateLimiting ¶
type RateLimiting struct { *Driver // contains filtered or unexported fields }
func (*RateLimiting) CheckSkill ¶
func (r *RateLimiting) CheckSkill(skill string) bool
func (*RateLimiting) Destroy ¶
func (r *RateLimiting) Destroy()
func (*RateLimiting) DoFilter ¶
func (r *RateLimiting) DoFilter(ctx http_service.IHttpContext, next http_service.IChain) (err error)
func (*RateLimiting) Id ¶
func (r *RateLimiting) Id() string
func (*RateLimiting) Reset ¶
func (r *RateLimiting) Reset(conf interface{}, workers map[eosc.RequireId]interface{}) error
func (*RateLimiting) Start ¶
func (r *RateLimiting) Start() error
func (*RateLimiting) Stop ¶
func (r *RateLimiting) Stop() error
Click to show internal directories.
Click to hide internal directories.