Documentation
¶
Overview ¶
Antireplay package has cache implementations that are effective against replay attacks.
To understand more about replay attacks, please read documentation for mtglib.AntiReplayCache interface. This package has a list of some implementations of this interface.
Index ¶
Constants ¶
const ( // DefaultStableBloomFilterMaxSize is a recommended byte size for a stable // bloom filter. DefaultStableBloomFilterMaxSize = 1024 * 1024 // 1MiB // DefaultStableBloomFilterErrorRate is a recommended default error rate for a // stable bloom filter. DefaultStableBloomFilterErrorRate = 0.001 )
Variables ¶
This section is empty.
Functions ¶
func NewNoop ¶
func NewNoop() mtglib.AntiReplayCache
NewNoop returns an implementation that does nothing. A corresponding method always returns false, so this cache accepts everything you pass to it.
func NewStableBloomFilter ¶
func NewStableBloomFilter(byteSize uint, errorRate float64) mtglib.AntiReplayCache
NewStableBloomFilter returns an implementation of AntiReplayCache based on stable bloom filter.
http://webdocs.cs.ualberta.ca/~drafiei/papers/DupDet06Sigmod.pdf
The basic idea of a stable bloom filter is quite simple: each time when you set a new element, you randomly reset P elements. There is a hardcore math which proves that if you choose this P correctly, you can maintain the same error rate for a stream of elements.
byteSize is the number of bytes you want to give to a bloom filter. errorRate is desired false-positive error rate. If you want to use default values, please pass 0 for byteSize and <0 for errorRate.
Types ¶
This section is empty.