Documentation
¶
Overview ¶
Package limitbase provides shared helpers for the rate-limit plugin family: limit-req, limit-conn, limit-count, and graphql-limit-count.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultVarPattern = regexp.MustCompile(`^\$\{\s*([0-9A-Za-z_]+)\s*\?\?\s*([^{}]+?)\s*\}$`)
DefaultVarPattern matches ${name ?? default} references with an inline fallback value used by limit-conn and limit-count.
View Source
var VarPattern = regexp.MustCompile(`\$\{([0-9A-Za-z_]+)\}|\$([0-9A-Za-z_]+)`)
VarPattern matches $name and ${name} variable references in key and value expressions used by limit-req and limit-conn.
Functions ¶
Types ¶
type QuotaHeaders ¶
QuotaHeaders names the rate-limit response headers.
func DefaultQuotaHeaders ¶
func DefaultQuotaHeaders(limitHeader, remainingHeader, resetHeader string) QuotaHeaders
DefaultQuotaHeaders returns the default quota header names, substituting the X-RateLimit-* names for empty fields.
func RuleQuotaHeaders ¶
func RuleQuotaHeaders(prefix string, index int) QuotaHeaders
RuleQuotaHeaders returns per-rule quota header names, numbering the rule index plus one when no header prefix is configured.
Click to show internal directories.
Click to hide internal directories.