Documentation
¶
Overview ¶
Package udpcheck sends bounded, tagged UDP delivery probes.
Index ¶
- Constants
- Variables
- func Resolve(ctx context.Context, host string) (netip.Addr, error)
- func Send(ctx context.Context, host string, ports []uint16, tag [8]byte, ...) (family string, sent int, err error)
- func SendDF(ctx context.Context, host string, ports []uint16, tag [8]byte, ...) (family string, sent int, err error)
- func Validate(host string, ports []uint16, count, pps, size int) error
- func ValidateDF(host string, ports []uint16, count, pps, size int, df bool) error
Constants ¶
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 ¶
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 ¶
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).
Types ¶
This section is empty.