* adds middleware for rate limiting
* added comment for InMemoryStore ShouldAllow
* removed redundant mutex declaration
* fixed lint issues
* removed sleep from tests
* improved coverage
* refactor: renames Identifiers, includes default SourceFunc
* Added last seen stats for visitor
* uses http Constants for improved readdability
adds default error handler
* used other handler apart from default handler to mark custom error handler for rate limiting
* split tests into separate blocks
added an error pair to IdentifierExtractor
Includes deny handler for explicitly denying requests
* adds comments for exported members Extractor and ErrorHandler
* makes cleanup implementation inhouse
* Avoid race for cleanup due to non-atomic access to store.expiresIn
* Use a dedicated producer for rate testing
* tidy commit
* refactors tests, implicitly tests lastSeen property on visitor
switches NewRateLimiterMemoryStore constructor to Referential Functions style (Advised by @pafuent)
* switches to mock of time module for time based tests
tests are now fully deterministic
* improved coverage
* replaces Rob Pike referential options with more conventional struct configs
makes cleanup asynchronous
* blocks racy access to lastCleanup
* Add benchmark tests for rate limiter
* Add rate limiter with sharded memory store
* Racy access to store.lastCleanup eliminated
Merges in shiny sharded map implementation by @lammel
* Remove RateLimiterShradedMemoryStore for now
* Make fields for RateLimiterStoreConfig public for external configuration
* Improve docs for RateLimiter usage
* Fix ErrorHandler vs. DenyHandler usage for rate limiter
* Simplify NewRateLimiterMemoryStore
* improved coverage
* updated errorHandler and denyHandler to use echo.HTTPError
* Improve wording for error and comments
* Remove duplicate lastSeen marking for Allow
* Improve wording for comments
* Add disclaimer on perf characteristics of memory store
* changes Allow signature on rate limiter to return err too
Co-authored-by: Roland Lammel <rl@neotel.at>
This reintroduces support for Go modules, as v4.
CloseNotifier() is removed as it has been obsoleted, see https://golang.org/doc/go1.11#net/http
It was already NOT working (not sending signals) as of 1.11 the functionality was gone, we merely
deleted the functions that exposed it. If anyone still relies on it they should migrate to using
`c.Request().Context().Done()` instead.
Closes#1268, #1255