debounce

package
v1.94.3 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDuplicateMessage is returned when a message has been duplicated.
	ErrDuplicateMessage = errors.New("duplicate initial message")
)

Functions

This section is empty.

Types

type Debouncer

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

Debouncer makes sure messages with the same hash are not repeated.

func NewDebouncer

func NewDebouncer(maxAge time.Duration, maxCount int) *Debouncer

NewDebouncer makes a Debouncer. Messages will only be stored in memory up until maxAge time, and once the same message has been received maxCount times it will be forgotten as well. maxCount is ignored when <= 0.

func (*Debouncer) ResponderFirstMessageValidator

func (d *Debouncer) ResponderFirstMessageValidator(addr net.Addr, message []byte) error

ResponderFirstMessageValidator is for use in noiseconn.Options.

Jump to

Keyboard shortcuts

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