udpcheck

package
v0.1.90-dev.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 9 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 udpcheck sends bounded, tagged UDP delivery probes.

Index

Constants

View Source
const (
	MaxPorts = 8
	MaxCount = 300
	MaxPPS   = 50
	MinSize  = 64
	MaxSize  = 1200
	// MaxSizeDF is the payload cap with the don't-fragment flag: an Ethernet MTU of 1500 less the IPv4 and UDP headers.
	MaxSizeDF = 1472
)

Variables

View Source
var (
	ErrBadParams       = errors.New("udpcheck: bad parameters")
	ErrUnsupportedHost = errors.New("udpcheck: unsupported destination")
	ErrNoRoute         = errors.New("udpcheck: no route")
	// ErrNoDF: this host cannot set the don't-fragment flag on a UDP socket.
	ErrNoDF = errors.New("udpcheck: don't-fragment is not supported on this host")
)

Functions

func Resolve

func Resolve(ctx context.Context, host string) (netip.Addr, error)

Resolve resolves a node address to one IP, preferring IPv4. Its behavior matches the health probe resolver.

func Send

func Send(ctx context.Context, host string, ports []uint16, tag [8]byte, count, pps, size int) (family string, sent int, err error)

Send emits count datagrams per port, one to every port per tick. sent is the number of complete ticks delivered to every port. The payload is generated once and reused, with tag as its first eight bytes.

func SendDF

func SendDF(ctx context.Context, host string, ports []uint16, tag [8]byte, count, pps, size int, df bool) (family string, sent int, err error)

SendDF is Send with the don't-fragment flag on every datagram when df is set (Linux only: ErrNoDF elsewhere), and a payload cap of MaxSizeDF. A datagram the local interface cannot carry whole fails the send (ErrNoRoute, EMSGSIZE).

func Validate

func Validate(host string, ports []uint16, count, pps, size int) error

Validate checks the same hard limits Send enforces before opening sockets.

func ValidateDF

func ValidateDF(host string, ports []uint16, count, pps, size int, df bool) error

ValidateDF is Validate with the larger payload cap of a don't-fragment send (MaxSizeDF).

Types

This section is empty.

Jump to

Keyboard shortcuts

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