aboutsummaryrefslogtreecommitdiffstats
path: root/replay/replay.go
diff options
context:
space:
mode:
authorRiobard Zhan <me@riobard.com>2020-09-10 02:06:44 +0800
committerJason A. Donenfeld <Jason@zx2c4.com>2020-10-14 10:46:00 +0200
commit2c143dce0ff55feb35c7f6b9199479db88909903 (patch)
treebb22f8ee6531aaedb338caf56f404ad0d96c96e2 /replay/replay.go
parentreplay: clean up internals and better documentation (diff)
downloadwireguard-go-2c143dce0ff55feb35c7f6b9199479db88909903.tar.xz
wireguard-go-2c143dce0ff55feb35c7f6b9199479db88909903.zip
replay: minor API changes to more idiomatic Go
Signed-off-by: Riobard Zhan <me@riobard.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'replay/replay.go')
-rw-r--r--replay/replay.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/replay/replay.go b/replay/replay.go
index 8685712..5b2de41 100644
--- a/replay/replay.go
+++ b/replay/replay.go
@@ -17,24 +17,24 @@ const (
bitMask = blockBits - 1
)
-// A ReplayFilter rejects replayed messages by checking if message counter value is
+// A Filter rejects replayed messages by checking if message counter value is
// within a sliding window of previously received messages.
-// The zero value for ReplayFilter is an empty filter ready to use.
+// The zero value for Filter is an empty filter ready to use.
// Filters are unsafe for concurrent use.
-type ReplayFilter struct {
+type Filter struct {
last uint64
ring [ringBlocks]block
}
-// Init resets the filter to empty state.
-func (f *ReplayFilter) Init() {
+// Reset resets the filter to empty state.
+func (f *Filter) Reset() {
f.last = 0
f.ring[0] = 0
}
// ValidateCounter checks if the counter should be accepted.
// Overlimit counters (>= limit) are always rejected.
-func (f *ReplayFilter) ValidateCounter(counter uint64, limit uint64) bool {
+func (f *Filter) ValidateCounter(counter uint64, limit uint64) bool {
if counter >= limit {
return false
}