rate_limiting

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: Apache-2.0 Imports: 8 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"` // 每秒请求次数限制
	Minute           int64  `json:"minute,omitempty"` // 每分钟请求次数限制
	Hour             int64  `json:"hour,omitempty"`   // 每小时请求次数限制
	Day              int64  `json:"day,omitempty"`    // 每天请求次数限制
	HideClientHeader bool   `json:"hideClientHeader"` // 请求结果是否隐藏流控信息
	ResponseType     string `json:"responseType"`     // 插件返回报错的类型
}

type Driver

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

func (*Driver) Check

func (d *Driver) Check(v interface{}, workers map[eosc.RequireId]interface{}) 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]interface{}) (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)

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

Jump to

Keyboard shortcuts

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