service

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 6 Imported by: 0

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.

Jump to

Keyboard shortcuts

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