icmpcheck

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: AGPL-3.0 Imports: 12 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 icmpcheck implements the ICMP (ping) monitor type (FA-CHK-30/31).

Index

Constants

View Source
const (
	ModeAuto         = "auto"
	ModePrivileged   = "privileged"   // raw socket, needs CAP_NET_RAW
	ModeUnprivileged = "unprivileged" // UDP ICMP socket, needs net.ipv4.ping_group_range
	ModeOff          = "off"
)

ICMP socket modes.

View Source
const Capability = "icmp"

Capability is the node capability ICMP monitors require (FA-CHK-31).

View Source
const Type = "icmp"

Type is the monitor type key.

Variables

This section is empty.

Functions

func DetectMode

func DetectMode(ctx context.Context, configured string) (string, error)

DetectMode returns the ICMP mode this node can use by pinging the loopback address (FA-CHK-31, FA-NODE-06). configured is auto, privileged, unprivileged or off. For auto, unprivileged is tried first because it needs no capability.

Types

type Checker

type Checker struct{}

Checker runs ICMP checks.

func (*Checker) Check

func (*Checker) Check(ctx context.Context, env *checker.Env, raw json.RawMessage) checker.Result

Check implements checker.Checker. pro-bing opens its own sockets, so the target is resolved here and checked against the dialer's address policy before any packet is sent (FA-SEC-SSRF).

func (*Checker) ConfigSchema

func (*Checker) ConfigSchema() json.RawMessage

ConfigSchema implements checker.Checker.

func (*Checker) Name

func (*Checker) Name() string

Name implements checker.Checker.

func (*Checker) RequiredCapability

func (*Checker) RequiredCapability() string

RequiredCapability implements checker.CapabilityRequirer.

func (*Checker) Targets

func (*Checker) Targets(raw json.RawMessage) ([]checker.Target, error)

Targets implements checker.TargetLister: the configured host is the destination (ADR 0030).

func (*Checker) Type

func (*Checker) Type() string

Type implements checker.Checker.

func (*Checker) Validate

func (*Checker) Validate(raw json.RawMessage) error

Validate implements checker.Checker.

type Config

type Config struct {
	Host       string `json:"host"`
	Count      int    `json:"count,omitempty"`
	IntervalMs int    `json:"intervalMs,omitempty"`
	// MaxPacketLossPercent: DOWN if the loss exceeds it. The default 100 means
	// DOWN only when no reply arrives.
	MaxPacketLossPercent *int   `json:"maxPacketLossPercent,omitempty"`
	IPFamily             string `json:"ipFamily,omitempty"`
}

Config is the ICMP monitor configuration.

Jump to

Keyboard shortcuts

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