Help us shape the future of Go! Take the 2026 Go Developer Survey

cliroute

package
v1.3.104 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cliroute is the output shape of the `skywire cli route` commands.

It lives here rather than in a function body so callers, and the e2e suite, can import it. The suite already runs `route --json`, `route rule --json` and `route add-rule ... --json` and parses what comes back.

Package cliroute pkg/cliout/cliroute/dial_settings.go

Output shape of `skywire cli route settings dial` — the visor's DIAL-TIME router knobs. Separate from Settings (the live-group knobs) so each command emits one document a caller can parse without first splitting it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DialSettings

type DialSettings struct {
	UnknownLatencyCostMs float64  `json:"unknown_latency_cost_ms"`
	UnknownHopPenaltyMs  float64  `json:"unknown_hop_penalty_ms"`
	TypePriorScale       float64  `json:"type_prior_scale"`
	ThroughputPriorScale float64  `json:"throughput_prior_scale"`
	RouteCandidates      int      `json:"route_candidates"`
	MuxRouteHeadroom     int      `json:"mux_route_headroom"`
	ForegroundMux        int      `json:"foreground_mux"`
	TunnelLegs           int      `json:"tunnel_legs"`
	DeadRouteYoungAge    string   `json:"dead_route_young_age"`
	WarmPlanTTL          string   `json:"warm_plan_ttl"`
	WarmPlanBucketCap    int      `json:"warm_plan_bucket_cap"`
	PreferPKs            []string `json:"prefer_pks"`
}

DialSettings is the current value of every dial-time router knob.

func (DialSettings) Human

func (s DialSettings) Human(w io.Writer) error

Human prints one knob per row: its catalog name (what `route settings <key>=<value>` and the persisted routing.router_settings map use), the flag that also sets it, and the live value. The prefer-PK list has no catalog name — its payload is not one int64 — so its first column is blank.

type Knob

type Knob struct {
	Kind      string `json:"kind"`
	Value     string `json:"value"`
	Default   string `json:"default"`
	Set       bool   `json:"set"`
	Persisted string `json:"persisted,omitempty"`
	Doc       string `json:"doc,omitempty"`
}

Knob is one row of Settings.KnobDetail.

type MinHops

type MinHops struct {
	MinHops int `json:"min_hops"`
}

MinHops is the result of setting the minimum hop count.

func (MinHops) Human

func (m MinHops) Human(w io.Writer) error

Human writes the confirmation the command printed.

type PolicyBench

type PolicyBench struct {
	Script     string `json:"script"`
	Iterations int    `json:"iterations"`
	// Durations are strings because that is what they were printed as, and a
	// caller comparing runs wants the same token it saw in the terminal.
	Total   string `json:"total"`
	Average string `json:"average"`
	P50     string `json:"p50"`
	P99     string `json:"p99"`
}

PolicyBench times repeated evaluations of a routing policy script.

func (PolicyBench) Human

func (p PolicyBench) Human(w io.Writer) error

Human writes the aligned block the command printed.

type Rule

type Rule struct {
	ID   routing.RouteID `json:"id"`
	Type string          `json:"type"`

	// App rules.
	LocalPort  string `json:"local_port,omitempty"`
	RemotePort string `json:"remote_port,omitempty"`
	RemotePK   string `json:"remote_pk,omitempty"`

	// Forward and intermediary-forward rules.
	NextRouteID string `json:"next_route_id,omitempty"`
	NextTpID    string `json:"next_transport_id,omitempty"`

	// ExpireAt keeps its hyphen: it is the name already emitted, and renaming
	// it would break every consumer parsing it today for the sake of tidiness.
	ExpireAt time.Duration `json:"expire-at"`
}

Rule is one routing rule as `skywire cli route` reports it.

The optional fields are per rule TYPE, not per flag: an app rule has ports and a remote key, a forward rule has a next hop, and neither carries the other's fields. omitempty is what keeps one type serving all three without a consumer having to recognize three documents.

type Settings

type Settings struct {
	ForceLocalRoutes    bool     `json:"force_local_routes"`
	ExistingTPOnly      bool     `json:"existing_tp_only"`
	MinHops             uint16   `json:"min_hops"`
	TransportPreference []string `json:"transport_preference"`

	// The mux send-window shape and the adaptive park hold.
	EcfMaxWindowBytes int64   `json:"ecf_max_window_bytes"`
	EcfMinWindowBytes int64   `json:"ecf_min_window_bytes"`
	EcfWindowMargin   float64 `json:"ecf_window_margin"`
	SendWindowWaitMax string  `json:"send_window_wait_max"`
	LegParkMinHold    string  `json:"leg_park_min_hold"`
	DeadRouteHold     string  `json:"dead_route_hold"`
	DeadRouteHoldMax  string  `json:"dead_route_hold_max"`
	MuxFEC            bool    `json:"mux_fec"`

	// Shared-bottleneck detection.
	SBDMinSamples      int     `json:"sbd_min_samples"`
	SBDSampleInterval  string  `json:"sbd_sample_interval"`
	SBDTrialWindow     string  `json:"sbd_trial_window"`
	SBDTrialLoss       float64 `json:"sbd_trial_loss"`
	SBDBackoff         string  `json:"sbd_backoff"`
	SBDMinEvidenceRate int64   `json:"sbd_min_evidence_rate"`
	// ForwardSpill reports whether a forward frame may leave the confined leg when
	// that leg is at its send window; ForwardSwitchMargin is how much lower a
	// challenger leg must measure, for two consecutive samples, to take the
	// direction.
	ForwardSpill        bool    `json:"forward_spill"`
	ForwardSwitchMargin float64 `json:"forward_switch_margin"`

	// LegStarveRatio is how many times the best ready leg's delay basis a leg's own
	// must exceed before the scheduler cuts it to LegProbeBytes per window instead
	// of a proportional share.
	LegStarveRatio float64 `json:"leg_starve_ratio"`
	LegProbeBytes  int64   `json:"leg_probe_bytes"`

	// SBDDemote reports whether a shared-bottleneck ruling may park a leg at all.
	// False (the default) means rulings are recorded as sbd_ruling mux events and
	// nothing is demoted.
	SBDDemote bool `json:"sbd_demote"`

	// Knobs is the WHOLE router knob catalog as a stable map of catalog name to
	// formatted value — the shape a bench runner saves before a sweep and feeds
	// back verbatim afterwards (`route settings k=v …`). It is the complete
	// surface; the typed fields above are the same values under their older
	// names, kept so existing consumers do not break.
	Knobs map[string]string `json:"knobs"`

	// KnobDetail carries each knob's compiled default, whether it was explicitly
	// set, and what the visor config holds for it — the persisted-vs-live view.
	KnobDetail map[string]Knob `json:"knob_detail,omitempty"`

	// AppKnobs is every per-app override map (`route settings --app <name>`),
	// keyed by app name. Absent when no app has overrides.
	AppKnobs map[string]map[string]string `json:"app_knobs,omitempty"`
}

Settings is the visor-wide router knobs (`route settings`).

func (Settings) Human

func (s Settings) Human(w io.Writer) error

Human writes one knob per line.

type Trace

type Trace struct {
	Src  string     `json:"src"`
	Dst  string     `json:"dst"`
	Hops []TraceHop `json:"hops"`
}

Trace is the whole path `route trace` measured. It was an anonymous struct marshaled inline, which is a shape no caller could name.

type TraceHop

type TraceHop struct {
	Index int           `json:"hop"`
	PK    cipher.PubKey `json:"pk"`
	// RTT is nanoseconds for scripting; the human path renders milliseconds.
	RTT           time.Duration `json:"rtt_ns,omitempty"`
	IsDestination bool          `json:"destination"`
	Error         string        `json:"error,omitempty"`
}

TraceHop is one hop of `route trace`.

Jump to

Keyboard shortcuts

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