ping

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 10 Imported by: 1 module, 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 ping is CION's SCMP-echo application: the network's health probe and the first resident of the pkg/apps namespace — a consumer of the path library (pkg/libs/scion) beside the control plane. A pinger resolves the freshest path to a destination, sends a count of requests, and reports per-reply RTT, the reply's path hops, and a loss summary; the responder that answers them is the node's own, part of the core, so the pinger is the application's whole surface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Conn is the pinger's socket; its port becomes the echo identifier the
	// replies return to.
	Conn *scion.Conn
	// Paths resolves paths to the destination.
	Paths Paths
	// Dst is the destination ISD-AS.
	Dst addr.IA
	// DstHost is the destination's underlay host address, which the
	// responder's socket is bound to.
	DstHost netip.Addr
	// Count is the number of requests to send.
	Count int
	// Interval is the time between requests.
	Interval time.Duration
	// Wait bounds the wait for each reply before it counts as lost.
	Wait time.Duration
	// Log receives a line per reply and the summary; nil discards them.
	Log func(string, ...any)
}

Config configures one ping run.

type Paths

type Paths interface {
	Path(ctx context.Context, dst addr.IA) (*spath.Decoded, error)
}

Paths is the node's path resolution the pinger calls: a path to the destination.

type ReplyStat

type ReplyStat struct {
	// Seq is the reply's sequence number.
	Seq uint16
	// RTT is the time from sending the request to reading the reply.
	RTT time.Duration
	// Hops is the number of hop fields of the reply's arrival path — the
	// reversed road the reply came by; a one-hop arrival counts one hop.
	Hops int
	// Segments is the number of segments of the arrival path.
	Segments int
}

ReplyStat is one matched reply.

type Report

type Report struct {
	// Sent is the number of requests sent.
	Sent int
	// Received is the number of requests answered.
	Received int
	// Replies holds one statistic per received reply.
	Replies []ReplyStat
	// Reresolves is the number of path resolutions beyond the first: expiry
	// or send errors re-resolved mid-run.
	Reresolves int
}

Report summarizes a ping run.

func Run

func Run(ctx context.Context, cfg Config) (*Report, error)

Run sends Count echo requests at Interval, matching replies by identifier and sequence. The path is resolved once and re-resolved whenever it expired or a send failed; the run continues either way. A destination no path resolves for is an error, not a hang.

func (*Report) Loss

func (r *Report) Loss() int

Loss returns the number of unanswered requests.

Jump to

Keyboard shortcuts

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