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

netview

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: 5 Imported by: 0

Documentation

Overview

Package netview pkg/visor/netview/netview.go c3-vis-core

The network-view table (SD services + TPD per-key transport counts + UT uptimes aggregated per-PK), shared by the native visor (pkg/visor) and the wasm-visor (cmd/wasm-visor). It is a near-leaf — only the stdlib (encoding/json + sort + strings + time) plus the wasm-safe tptypes leaf (the canonical transport-type list) — so the wasm-visor can import it; pkg/visor itself does NOT compile for js/wasm. Keeping the aggregation here means the native and browser visors can't drift on how the table is built.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	PK       string `json:"pk"`
	Country  string `json:"country,omitempty"`
	Version  string `json:"version,omitempty"`
	Services string `json:"services,omitempty"`
	STCPR    int    `json:"stcpr"`
	SUDPH    int    `json:"sudph"`
	DMSG     int    `json:"dmsg"`
	STCP     int    `json:"stcp"`
	SQUICR   int    `json:"squicr"`
	WEBRTC   int    `json:"webrtc"`
	SWSR     int    `json:"swsr"`
	SWTR     int    `json:"swtr"`
	Total    int    `json:"total"`
	UTStatus string `json:"ut_status,omitempty"` // "online" | "offline" | "" (not in UT)
}

Entry is one row of the combined network table. JSON tags match what `cli sd --json` emits so callers (UI, scripts) consume both interchangeably.

type Response

type Response struct {
	Entries   []Entry   `json:"entries"`
	FetchedAt time.Time `json:"fetched_at"`
}

Response is the /api/network-view payload.

func Compute

func Compute(fetch func(service, path string) ([]byte, error)) *Response

Compute aggregates SD (proxy/vpn/visor) + TPD all-transports + UT uptimes into the per-PK table, via the supplied deployment-service fetch (service ∈ {sd,tpd,ut}, path → raw JSON). A partial failure on any source is treated as an empty slice — the table renders with whatever was reachable.

Jump to

Keyboard shortcuts

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