middleware implements [proxy.Middleware] with rate limiting functionality.
| 17 | |
| 18 | // middleware implements [proxy.Middleware] with rate limiting functionality. |
| 19 | type middleware struct { |
| 20 | buckets *gocache.Cache |
| 21 | logger *slog.Logger |
| 22 | |
| 23 | // mu protects buckets. |
| 24 | mu *sync.Mutex |
| 25 | |
| 26 | allowlistAddrs netutil.SliceSubnetSet |
| 27 | ratelimit uint |
| 28 | subnetLenIPv4 uint |
| 29 | subnetLenIPv6 uint |
| 30 | } |
| 31 | |
| 32 | // NewMiddleware returns middleware with rate limiting functionality. c must be |
| 33 | // valid. |
nothing calls this directly
no outgoing calls
no test coverage detected