dedup

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package dedup implements bounded direction-local packet deduplication.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidCapacity indicates a non-positive deduplication window size.
	ErrInvalidCapacity = errors.New("invalid deduplication capacity")
)

Functions

This section is empty.

Types

type Result

type Result uint8

Result describes how a packet sequence number relates to the retained window.

const (
	// New identifies a sequence number not previously observed in the retained window.
	New Result = iota
	// Duplicate identifies a sequence number already observed in the retained window.
	Duplicate
	// TooOld identifies a sequence number older than the retained window.
	TooOld
)

type Window

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

Window retains a fixed number of direction-local packet sequence numbers.

func NewWindow

func NewWindow(capacity int) (*Window, error)

NewWindow returns a fixed-capacity deduplication window.

func (*Window) Classify

func (w *Window) Classify(sequence uint64) Result

Classify reports how sequence relates to the retained window without recording it.

func (*Window) Highest

func (w *Window) Highest() uint64

Highest returns the largest sequence number observed by the window.

func (*Window) Observe

func (w *Window) Observe(sequence uint64) Result

Observe records sequence and returns whether it is new, duplicated, or too old.

Jump to

Keyboard shortcuts

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