<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-go/ratelimiter, branch js/sample-api</title>
<subtitle>Go implementation of WireGuard</subtitle>
<id>https://git.zx2c4.com/wireguard-go/atom/ratelimiter?h=js%2Fsample-api</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-go/atom/ratelimiter?h=js%2Fsample-api'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/'/>
<updated>2020-05-02T08:08:26Z</updated>
<entry>
<title>global: update header comments and modules</title>
<updated>2020-05-02T08:08:26Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2020-05-02T08:08:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=db0aa39b765243c6a4ac9a2e348311df9517c0bf'/>
<id>urn:sha1:db0aa39b765243c6a4ac9a2e348311df9517c0bf</id>
<content type='text'>
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>ratelimiter: use a fake clock in tests and style cleanups</title>
<updated>2020-03-30T07:38:36Z</updated>
<author>
<name>David Crawshaw</name>
<email>crawshaw@tailscale.com</email>
</author>
<published>2019-12-08T23:22:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=9cd8909df2ad882b81b611b4656020aeceb6c9b2'/>
<id>urn:sha1:9cd8909df2ad882b81b611b4656020aeceb6c9b2</id>
<content type='text'>
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 &lt; 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 &lt;crawshaw@tailscale.com&gt;
</content>
</entry>
<entry>
<title>global: fix a few typos courtesy of codespell</title>
<updated>2019-10-22T09:51:25Z</updated>
<author>
<name>Jonathan Tooker</name>
<email>jonathan.tooker@netprotect.com</email>
</author>
<published>2019-10-21T20:52:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=f7d0edd2ecf5f7f5aed188823de0a122691a7de6'/>
<id>urn:sha1:f7d0edd2ecf5f7f5aed188823de0a122691a7de6</id>
<content type='text'>
Signed-off-by: Jonathan Tooker &lt;jonathan.tooker@netprotect.com&gt;
</content>
</entry>
<entry>
<title>device, ratelimiter: replace uses of time.Now().Sub() with time.Since()</title>
<updated>2019-06-03T20:15:41Z</updated>
<author>
<name>Matt Layher</name>
<email>mdlayher@gmail.com</email>
</author>
<published>2019-06-03T19:46:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=18b6627f33883e28dd69b2990c52359002856694'/>
<id>urn:sha1:18b6627f33883e28dd69b2990c52359002856694</id>
<content type='text'>
Simplification found by staticcheck:

$ staticcheck ./... | grep S1012
device/cookie.go:90:5: should use time.Since instead of time.Now().Sub (S1012)
device/cookie.go:127:5: should use time.Since instead of time.Now().Sub (S1012)
device/cookie.go:242:5: should use time.Since instead of time.Now().Sub (S1012)
device/noise-protocol.go:304:13: should use time.Since instead of time.Now().Sub (S1012)
device/receive.go:82:46: should use time.Since instead of time.Now().Sub (S1012)
device/send.go:132:5: should use time.Since instead of time.Now().Sub (S1012)
device/send.go:139:5: should use time.Since instead of time.Now().Sub (S1012)
device/send.go:235:59: should use time.Since instead of time.Now().Sub (S1012)
device/send.go:393:9: should use time.Since instead of time.Now().Sub (S1012)
ratelimiter/ratelimiter.go:79:10: should use time.Since instead of time.Now().Sub (S1012)
ratelimiter/ratelimiter.go:87:10: should use time.Since instead of time.Now().Sub (S1012)

Change applied using:

$ find . -type f -name "*.go" -exec sed -i "s/Now().Sub(/Since(/g" {} \;

Signed-off-by: Matt Layher &lt;mdlayher@gmail.com&gt;
</content>
</entry>
<entry>
<title>Extend structs rather than embed, when possible</title>
<updated>2019-02-05T11:59:42Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2019-01-03T18:04:00Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7'/>
<id>urn:sha1:89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Update copyright</title>
<updated>2019-02-05T11:59:42Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2019-01-02T00:55:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=dff424baf8acc4d2a5858d3947761c5090d8e640'/>
<id>urn:sha1:dff424baf8acc4d2a5858d3947761c5090d8e640</id>
<content type='text'>
</content>
</entry>
<entry>
<title>global: fix up copyright headers</title>
<updated>2018-09-16T16:49:19Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2018-09-05T21:54:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=5be541d147562bf87f6a9ebd551412d4a6920b4b'/>
<id>urn:sha1:5be541d147562bf87f6a9ebd551412d4a6920b4b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>ratelimiter: do not run GC with nothing to do</title>
<updated>2018-05-21T01:20:18Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2018-05-21T01:18:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=e28d70f5b2a00af75aa9f283e31c7da31a2913df'/>
<id>urn:sha1:e28d70f5b2a00af75aa9f283e31c7da31a2913df</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Cleanup ratelimiter</title>
<updated>2018-05-13T16:42:06Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2018-05-13T16:42:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=e94185681f4c19874392019b0d43bdfefcbb85b5'/>
<id>urn:sha1:e94185681f4c19874392019b0d43bdfefcbb85b5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>global: Add SPDX tags and copyright header</title>
<updated>2018-05-03T13:06:25Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2018-05-03T13:04:00Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-go/commit/?id=a040786645ec980059937fd6a1a361b160c1a809'/>
<id>urn:sha1:a040786645ec980059937fd6a1a361b160c1a809</id>
<content type='text'>
Mathias should probably add his copyright headers to each file too.
</content>
</entry>
</feed>
