diff options
Diffstat (limited to 'internal/web/server.go')
| -rw-r--r-- | internal/web/server.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/web/server.go b/internal/web/server.go index 6009310..f02dd68 100644 --- a/internal/web/server.go +++ b/internal/web/server.go @@ -26,14 +26,15 @@ type Server struct { root http.Handler blog http.Handler // Anonymous endpoints worth abusing get a token bucket each (ratelimit.go). - loginLimit *limiter // per client address and per username: 10 guesses, then 10 a minute + loginLimit *limiter // per client address and per username: 10 guesses, then 10 a minute + searchLimit *limiter // per client address: the search is an unindexed regex scan } // logf is log.Printf, a variable so tests can silence it. var logf = log.Printf func NewServer(cfg *config.Config, st *store.Store) *Server { - s := &Server{cfg: cfg, st: st, tpl: newTemplates(cfg.Dev), loginLimit: newLimiter(10, 10)} + s := &Server{cfg: cfg, st: st, tpl: newTemplates(cfg.Dev), loginLimit: newLimiter(10, 10), searchLimit: newLimiter(30, 30)} s.root = s.rootRoutes() s.blog = s.subdomainRoutes() return s |
