rate_limiting

package
v0.8.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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) Check

func (d *Driver) Check(v interface{}, workers map[eosc.RequireId]eosc.IWorker) error

func (*Driver) ConfigType

func (d *Driver) ConfigType() reflect.Type

func (*Driver) Create

func (d *Driver) Create(id, name string, v interface{}, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)

type Factory

type Factory struct {
}

func NewFactory

func NewFactory() *Factory

func (*Factory) Create

func (f *Factory) Create(profession string, name string, label string, desc string, params map[string]interface{}) (eosc.IExtenderDriver, error)

func (*Factory) Render added in v0.6.0

func (d *Factory) Render() interface{}

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 eocontext.EoContext, next eocontext.IChain) (err error)

func (*RateLimiting) DoHttpFilter added in v0.8.0

func (r *RateLimiting) DoHttpFilter(ctx http_service.IHttpContext, next eocontext.IChain) (err error)

func (*RateLimiting) Id

func (r *RateLimiting) Id() string

func (*RateLimiting) Reset

func (r *RateLimiting) Reset(conf interface{}, workers map[eosc.RequireId]eosc.IWorker) error

func (*RateLimiting) Start

func (r *RateLimiting) Start() error

func (*RateLimiting) Stop

func (r *RateLimiting) Stop() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL