MCPcopy Index your code
hub / github.com/dnote/dnote / NewRateLimiter

Function NewRateLimiter

pkg/server/middleware/limit.go:47–53  ·  view source on GitHub ↗

NewRateLimiter creates a new rate limiter instance

()

Source from the content-addressed store, hash-verified

45
46// NewRateLimiter creates a new rate limiter instance
47func NewRateLimiter() *RateLimiter {
48 rl := &RateLimiter{
49 visitors: make(map[string]*visitor),
50 }
51 go rl.cleanupVisitors()
52 return rl
53}
54
55var defaultLimiter = NewRateLimiter()
56

Callers 3

limit.goFile · 0.85
TestLimitFunction · 0.85
TestLimit_DifferentIPsFunction · 0.85

Calls 1

cleanupVisitorsMethod · 0.95

Tested by 2

TestLimitFunction · 0.68
TestLimit_DifferentIPsFunction · 0.68