replay

package
v3.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyTag = ""
)

Variables

View Source
var (
	// Number of replay packets sent from a new session.
	NewSession = metrics.RegisterMetric("replay", "NewSession", metrics.COUNTER)

	// Number of replay packets sent from a new session that can be decrypted.
	NewSessionDecrypted = metrics.RegisterMetric("replay", "NewSessionDecrypted", metrics.COUNTER)

	// Number of replay packets sent from a known session.
	KnownSession = metrics.RegisterMetric("replay", "KnownSession", metrics.COUNTER)
)

Functions

This section is empty.

Types

type ReplayCache

type ReplayCache struct {
	// contains filtered or unexported fields
}

ReplayCache stores the signature of recent decrypted packets to avoid a replay attack.

func NewCache

func NewCache(capacity int, expireInterval time.Duration) *ReplayCache

NewCache creates a new replay cache.

func (*ReplayCache) Clear

func (c *ReplayCache) Clear()

Clear removes all the data in the replay cache.

func (*ReplayCache) IsDuplicate

func (c *ReplayCache) IsDuplicate(data []byte, tag string) bool

IsDuplicate checks if the given data is present in the replay cache. If a non-empty tag is provided, it is not considered as a duplicate when the same tag is used. This can allow retransmit exact content from the same network address. Use an empty tag disables this feature.

func (*ReplayCache) Sizes

func (c *ReplayCache) Sizes() (int, int)

Sizes returns the number of entries in `current` map and `previous` map.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL