rate_limiting

package
v0.17.7 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 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 Create added in v0.9.0

func Create(id, name string, conf *Config, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)

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 Driver

type Driver struct {
	// contains filtered or unexported fields
}

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