aboutsummaryrefslogtreecommitdiffstats
path: root/ratelimiter/ratelimiter_test.go (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-05-02global: update header comments and modulesJason A. Donenfeld1-1/+1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-03-30ratelimiter: use a fake clock in tests and style cleanupsDavid Crawshaw1-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>
2019-10-22global: fix a few typos courtesy of codespellJonathan Tooker1-1/+1
Signed-off-by: Jonathan Tooker <jonathan.tooker@netprotect.com>
2019-02-05Update copyrightJason A. Donenfeld1-2/+2
2018-09-16global: fix up copyright headersJason A. Donenfeld1-1/+1
2018-05-03global: Add SPDX tags and copyright headerJason A. Donenfeld1-0/+5
Mathias should probably add his copyright headers to each file too.
2018-02-12Use relative importsJason A. Donenfeld1-0/+0
2018-02-12Revert "Don't use modules"Mathias Hall-Andersen1-1/+1
This reverts commit bffe99aeadae09abd02f2bd3184925af6b680535.
2018-02-12Don't use modulesJason A. Donenfeld1-1/+1
Feel free to revert this if you have a strong feeling about it. But so far as I can see, it adds a lot of complexity for basically no upsides.
2018-02-11Removed exported methods from ratelimiter packageMathias Hall-Andersen1-3/+3
2018-02-11Moved ratelimiter to internal packageMathias Hall-Andersen1-1/+1
2018-02-04Align with go library layoutMathias Hall-Andersen1-0/+0
2017-07-11Added ratelimiting of handshake messagesMathias Hall-Andersen1-0/+98