Versions in this module Expand all Collapse all v0 v0.1.0 Jun 25, 2026 Changes in this version + func ClientIP(r *http.Request) string + type KeyFunc func(r *http.Request) string + type Policy struct + Limit int + Name string + Window time.Duration + func Rate(name string, limit int, window time.Duration) Policy + type Service struct + func FromKernel(k *togo.Kernel) (*Service, bool) + func New() *Service + func (s *Service) Allow(_ context.Context, key string, p Policy) (allowed bool, retryAfter time.Duration) + func (s *Service) Define(p Policy) + func (s *Service) Middleware(p Policy, keyFn KeyFunc) func(http.Handler) http.Handler + func (s *Service) Policy(name string) (Policy, bool) + func (s *Service) WithStore(store Store) *Service + type Store interface + Take func(key string, p Policy, now time.Time) (allowed bool, remaining int, reset time.Time)