Documentation ¶
Index ¶
- Constants
- func Create(id, name string, conf *Config, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)
- func CreateRateInfo(conf *Config) *rateInfo
- func NewFactory() eosc.IExtenderDriverFactory
- func Register(register eosc.IExtenderDriverRegister)
- type Config
- type Driver
- type RateLimiting
- func (r *RateLimiting) CheckSkill(skill string) bool
- func (r *RateLimiting) Destroy()
- func (r *RateLimiting) DoFilter(ctx eocontext.EoContext, next eocontext.IChain) (err error)
- func (r *RateLimiting) DoHttpFilter(ctx http_service.IHttpContext, next eocontext.IChain) (err error)
- func (r *RateLimiting) Reset(conf interface{}, workers map[eosc.RequireId]eosc.IWorker) 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 NewFactory ¶
func NewFactory() eosc.IExtenderDriverFactory
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 RateLimiting ¶
type RateLimiting struct { drivers.WorkerBase // contains filtered or unexported fields }
func (*RateLimiting) CheckSkill ¶
func (r *RateLimiting) CheckSkill(skill string) bool
func (*RateLimiting) Destroy ¶
func (r *RateLimiting) Destroy()
func (*RateLimiting) DoHttpFilter ¶ added in v0.8.0
func (r *RateLimiting) DoHttpFilter(ctx http_service.IHttpContext, next eocontext.IChain) (err 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.