throttle

package
v0.0.0-...-a101f2f Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const RetryKey = "Retried_times"

Variables

This section is empty.

Functions

func NewContextLimitFilter

func NewContextLimitFilter(c *config.Config) (pipeline.Filter, error)

func NewDropFilter

func NewDropFilter(c *config.Config) (pipeline.Filter, error)

func NewElasticsearchBulkRequestThrottleFilter

func NewElasticsearchBulkRequestThrottleFilter(c *config.Config) (pipeline.Filter, error)

func NewHealthCheckFilter

func NewHealthCheckFilter(c *config.Config) (pipeline.Filter, error)

func NewRequestAPIKeyLimitFilter

func NewRequestAPIKeyLimitFilter(c *config.Config) (pipeline.Filter, error)

func NewRequestClientIPLimitFilter

func NewRequestClientIPLimitFilter(c *config.Config) (pipeline.Filter, error)

func NewRequestHostLimitFilter

func NewRequestHostLimitFilter(c *config.Config) (pipeline.Filter, error)

func NewRequestPathLimitFilter

func NewRequestPathLimitFilter(c *config.Config) (pipeline.Filter, error)

func NewRequestUserLimitFilter

func NewRequestUserLimitFilter(c *config.Config) (pipeline.Filter, error)

func NewRetryLimiter

func NewRetryLimiter(c *config.Config) (pipeline.Filter, error)

func NewSleepFilter

func NewSleepFilter(c *config.Config) (pipeline.Filter, error)

Types

type ContextLimitFilter

type ContextLimitFilter struct {
	Context []string `config:"context"`
	// contains filtered or unexported fields
}

func (*ContextLimitFilter) Filter

func (filter *ContextLimitFilter) Filter(ctx *fasthttp.RequestCtx)

func (*ContextLimitFilter) Name

func (filter *ContextLimitFilter) Name() string

type DropFilter

type DropFilter struct {
	param.Parameters
}

func (*DropFilter) Filter

func (filter *DropFilter) Filter(ctx *fasthttp.RequestCtx)

func (*DropFilter) Name

func (filter *DropFilter) Name() string

type ElasticsearchBulkRequestThrottle

type ElasticsearchBulkRequestThrottle struct {
	Indices map[string]*config.Config `config:"indices"`
	// contains filtered or unexported fields
}

func (*ElasticsearchBulkRequestThrottle) Filter

func (*ElasticsearchBulkRequestThrottle) Name

type ElasticsearchHealthCheckFilter

type ElasticsearchHealthCheckFilter struct {
	Elasticsearch string `config:"elasticsearch"`
	Interval      int    `config:"interval"`
}

func (*ElasticsearchHealthCheckFilter) Filter

func (filter *ElasticsearchHealthCheckFilter) Filter(ctx *fasthttp.RequestCtx)

func (*ElasticsearchHealthCheckFilter) Name

func (filter *ElasticsearchHealthCheckFilter) Name() string

type GenericLimiter

type GenericLimiter struct {
	MaxRequests    int    `config:"max_requests"`
	BurstRequests  int    `config:"burst_requests"`
	MaxBytes       int    `config:"max_bytes"`
	BurstBytes     int    `config:"burst_bytes"`
	Interval       string `config:"interval"`
	Action         string `config:"action"`
	MaxRetryTimes  int    `config:"max_retry_times"`
	RetryDelayInMs int    `config:"retry_delay_in_ms"`
	Status         int    `config:"status"`
	Message        string `config:"message"`
	WarnMessage    bool   `config:"log_warn_message"`
	RetriedMessage string `config:"failed_retry_message"`
	// contains filtered or unexported fields
}

type MatchRules

type MatchRules struct {
	Pattern string `config:"pattern"` //pattern
	MaxQPS  int64  `config:"max_qps"` //max_qps

	ExtractGroup string `config:"group"`
	// contains filtered or unexported fields
}

func (*MatchRules) Extract

func (this *MatchRules) Extract(input string) string

func (*MatchRules) Match

func (this *MatchRules) Match(input string) bool

func (*MatchRules) Valid

func (this *MatchRules) Valid() bool

type RequestAPIKeyLimitFilter

type RequestAPIKeyLimitFilter struct {
	APIKeys []string `config:"id"`
	// contains filtered or unexported fields
}

func (*RequestAPIKeyLimitFilter) Filter

func (filter *RequestAPIKeyLimitFilter) Filter(ctx *fasthttp.RequestCtx)

func (*RequestAPIKeyLimitFilter) Name

func (filter *RequestAPIKeyLimitFilter) Name() string

type RequestClientIPLimitFilter

type RequestClientIPLimitFilter struct {
	IP []string `config:"ip"`
	// contains filtered or unexported fields
}

func (*RequestClientIPLimitFilter) Filter

func (filter *RequestClientIPLimitFilter) Filter(ctx *fasthttp.RequestCtx)

func (*RequestClientIPLimitFilter) Name

func (filter *RequestClientIPLimitFilter) Name() string

type RequestHostLimitFilter

type RequestHostLimitFilter struct {
	Host []string `config:"host"`
	// contains filtered or unexported fields
}

func (*RequestHostLimitFilter) Filter

func (filter *RequestHostLimitFilter) Filter(ctx *fasthttp.RequestCtx)

func (*RequestHostLimitFilter) Name

func (filter *RequestHostLimitFilter) Name() string

type RequestPathLimitFilter

type RequestPathLimitFilter struct {
	WarnMessage bool          `config:"log_warn_message"`
	Message     string        `config:"message"`
	Rules       []*MatchRules `config:"rules"`
}

func (*RequestPathLimitFilter) Filter

func (filter *RequestPathLimitFilter) Filter(ctx *fasthttp.RequestCtx)

func (*RequestPathLimitFilter) Name

func (filter *RequestPathLimitFilter) Name() string

type RequestUserLimitFilter

type RequestUserLimitFilter struct {
	User []string `config:"user"`
	// contains filtered or unexported fields
}

func (*RequestUserLimitFilter) Filter

func (filter *RequestUserLimitFilter) Filter(ctx *fasthttp.RequestCtx)

func (*RequestUserLimitFilter) Name

func (filter *RequestUserLimitFilter) Name() string

type RetryLimiter

type RetryLimiter struct {
	MaxRetryTimes int      `config:"max_retry_times"`
	SleepInterval int      `config:"retry_interval_in_ms"`
	Queue         string   `config:"queue_name"`
	TagsOnSuccess []string `config:"tag_on_success"` //hit limiter then add tag
}

func (*RetryLimiter) Filter

func (filter *RetryLimiter) Filter(ctx *fasthttp.RequestCtx)

func (*RetryLimiter) Name

func (filter *RetryLimiter) Name() string

type SleepFilter

type SleepFilter struct {
	SleepInMs int `config:"sleep_in_million_seconds"`
}

func (*SleepFilter) Filter

func (filter *SleepFilter) Filter(ctx *fasthttp.RequestCtx)

func (*SleepFilter) Name

func (filter *SleepFilter) Name() string

Jump to

Keyboard shortcuts

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