Documentation ¶
Overview ¶
Package replayfilter implements a generic replay detection filter with a caller specifiable time-to-live. It only detects if a given byte sequence has been seen before based on the SipHash-2-4 digest of the sequence. Collisions are treated as positive matches, though the probability of this happening is negligible.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReplayFilter ¶
ReplayFilter is a simple filter designed only to detect if a given byte sequence has been seen before.
func New ¶
func New(ttl time.Duration) (filter *ReplayFilter, err error)
New creates a new ReplayFilter instance.
func (*ReplayFilter) TestAndSet ¶
func (f *ReplayFilter) TestAndSet(now time.Time, buf []byte) bool
TestAndSet queries the filter for a given byte sequence, inserts the sequence, and returns if it was present before the insertion operation.
Click to show internal directories.
Click to hide internal directories.