aboutsummaryrefslogtreecommitdiffstats
path: root/ratelimiter/ratelimiter_test.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* global: bump copyright yearJason A. Donenfeld2023-02-071-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: bump copyright yearJason A. Donenfeld2022-09-201-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* all: update to Go 1.18Josh Bleecher Snyder2022-03-161-2/+1
| | | | | | | | | | Bump go.mod and README. Switch to upstream net/netip. Use strings.Cut. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
* global: use netip where possible nowJason A. Donenfeld2021-11-231-16/+17
| | | | | | | | There are more places where we'll need to add it later, when Go 1.18 comes out with support for it in the "net" package. Also, allowedips still uses slices internally, which might be suboptimal. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: bump copyrightJason A. Donenfeld2021-01-281-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: update header comments and modulesJason A. Donenfeld2020-05-021-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ratelimiter: use a fake clock in tests and style cleanupsDavid Crawshaw2020-03-301-19/+35
| | | | | | | | | | | | | | | | | | | | | | The existing test would occasionally flake out with: --- FAIL: TestRatelimiter (0.12s) ratelimiter_test.go:99: Test failed for 127.0.0.1 , on: 7 ( not having refilled enough ) expected: false got: true FAIL FAIL golang.zx2c4.com/wireguard/ratelimiter 0.171s The fake clock also means the tests run much faster, so testing this package with -count=1000 now takes < 100ms. While here, several style cleanups. The most significant one is unembeding the sync.Mutex fields in the rate limiter objects. Embedded as they were, the lock methods were accessible outside the ratelimiter package. As they aren't needed externally, keep them internal to make them easier to reason about. Passes `go test -race -count=10000 ./ratelimiter` Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
* global: fix a few typos courtesy of codespellJonathan Tooker2019-10-221-1/+1
| | | | Signed-off-by: Jonathan Tooker <jonathan.tooker@netprotect.com>
* Update copyrightJason A. Donenfeld2019-02-051-2/+2
|
* global: fix up copyright headersJason A. Donenfeld2018-09-161-1/+1
|
* global: Add SPDX tags and copyright headerJason A. Donenfeld2018-05-031-0/+5
| | | | Mathias should probably add his copyright headers to each file too.
* Use relative importsJason A. Donenfeld2018-02-121-0/+98