dedup

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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