Documentation
¶
Overview ¶
Package service provides rate limiting services for resolving and evaluating policies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimitResult ¶
type RateLimitResult struct {
limiter.LimiterResult
Limit int
}
RateLimitResult contains the result of a rate-limit evaluation.
type RateLimitService ¶
type RateLimitService struct {
// contains filtered or unexported fields
}
func NewRateLimitService ¶
func NewRateLimitService( resolver identifier.IdentifierResolver, policyStore store.PolicyRepository, groupMemberStore store.PolicyGroupMemberRepository, manager *limiter.Manager, ) *RateLimitService
NewRateLimitService creates a rate-limit service using the provided identifier resolver, policy repositories, and limiter manager.
func (*RateLimitService) Evaluate ¶
func (r *RateLimitService) Evaluate(req *http.Request) (RateLimitResult, error)
Evaluate resolves the request's identifier and evaluates it against the applicable rate-limiting policy.
An individual policy takes precedence over a policy group. If no individual policy exists, the identifier's policy group is used when the identifier is a member of one.
Click to show internal directories.
Click to hide internal directories.