ui2

package
v1.3.111 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Package ui2 pkg/visor/ui2/apps.go c3-vis-core

Package ui2 pkg/visor/ui2/bandwidth.go c3-vis-core

Package ui2 pkg/visor/ui2/bulk.go c3-vis-core

Package ui2 pkg/visor/ui2/catalog.go c3-vis-core

Package ui2 pkg/visor/ui2/chat.go c3-vis-core

Package ui2 pkg/visor/ui2/contacts.go c3-vis-core

Package ui2 pkg/visor/ui2/dmsg.go c3-vis-core

Package ui2 pkg/visor/ui2/flags.go c3-vis-core

Package ui2 pkg/visor/ui2/fleetuptime.go c3-vis-core

Package ui2 pkg/visor/ui2/hvsettings.go c3-vis-core

Package ui2 pkg/visor/ui2/i18n.go c3-vis-core

Package ui2 pkg/visor/ui2/info.go c3-vis-core

Package ui2 pkg/visor/ui2/logs.go c3-vis-core

Package ui2 pkg/visor/ui2/mail.go c3-vis-core

Package ui2 pkg/visor/ui2/nodes.go c3-vis-core

Package ui2 pkg/visor/ui2/paging.go c3-vis-core

Package ui2 pkg/visor/ui2/resources.go c3-vis-core

Package ui2 pkg/visor/ui2/rewards.go c3-vis-core

Package ui2 pkg/visor/ui2/routing.go c3-vis-core

Package ui2 pkg/visor/ui2/services.go c3-vis-core

Package ui2 pkg/visor/ui2/settings.go c3-vis-core

Package ui2 pkg/visor/ui2/tabs.go c3-vis-core

Package ui2 pkg/visor/ui2/transports.go c3-vis-core

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

Package ui2 is a server rendered hypervisor UI built with templ and htmx. It only renders. The hypervisor handlers fetch the data from the visor API and hand it here, so the package carries no visor dependency.

Never use html/template or text/template here: they panic under TinyGo.

Package ui2 pkg/visor/ui2/uptime.go c3-vis-core

Package ui2 pkg/visor/ui2/voice.go c3-vis-core

Index

Constants

View Source
const (
	BulkRestart = "restart"
	BulkReward  = "reward"
	BulkAdd     = "add"
	BulkStart   = "start"
	BulkStop    = "stop"
)

The bulk actions of the visor list, as the Angular list's selection bar (node-list.component.ts and bulk-app-action.component.ts).

View Source
const (
	FolderInbox  = "INBOX"
	FolderSent   = "Sent"
	FolderOutbox = "Outbox"
)

Mail folders, as the visor names them.

View Source
const (
	WalletRunning = "running"
	WalletStopped = "stopped"
	WalletMissing = "missing"
)

The states of the hypervisor's skycoin-web app for the wallet tab.

View Source
const HTMXVersion = "2.0.11"

HTMXVersion is the vendored static/htmx.min.js, checked against the npm tarball integrity of htmx.org@2.0.11.

View Source
const LangCookie = "ui2-lang"

LangCookie holds the chosen language. ui2.js keeps it in step with the Angular UI's "lang" localStorage entry.

View Source
const ListPageSize = 100

ListPageSize is how many rows a long list renders at once.

View Source
const LogMax = 1000

LogMax is how many entries the tab keeps, as the Angular one does.

View Source
const RefreshCookie = "ui2-refresh"

RefreshCookie holds the visor list's poll interval in seconds. ui2.js keeps it in step with the Angular UI's refreshSeconds entry.

Variables

View Source
var AlertDelays = []struct{ Value, Label string }{
	{"1m0s", "1 min"}, {"5m0s", "5 min"}, {"15m0s", "15 min"}, {"30m0s", "30 min"}, {"1h0m0s", "1 h"},
}

AlertDelays are the Angular form's offline delays.

View Source
var CatalogKinds = []string{"server", "client", "service", "external"}

CatalogKinds is the order the groups are shown in.

View Source
var Langs = []Lang{
	{"en", "English"},
	{"es", "Español"},
	{"de", "Deutsch"},
	{"pt", "Português (Brazil)"},
	{"zh", "中文"},
}

Langs follows the languages list of the Angular UI (static/skywire-manager-src/src/app/app.config.ts).

View Source
var LogLevels = []struct {
	Level LogLevel
	Label string
}{
	{LevelUnknown, "All"}, {LevelDebug, "Debug+"}, {LevelInfo, "Info+"}, {LevelWarn, "Warn+"},
	{LevelError, "Error+"}, {LevelFatal, "Fatal+"}, {LevelPanic, "Panic"},
}

LogLevels are the filter buttons, as the Angular tab labels them.

View Source
var RefreshChoices = []int{3, 5, 10, 15, 30, 60, 90, 150, 300}

RefreshChoices are the Angular settings page's refresh rates (refresh-rate.component.ts).

View Source
var RoutingViews = []string{"rules", "groups", "find", "calc", "policies"}

RoutingViews are the routing tab's sub views, after routing.component.html. The mux tree is the route visualizer page.

View Source
var UptimeTiers = []string{"process", "dmsg", "skynet"}

UptimeTiers is the order the Angular tab draws the tiers in.

View Source
var VisorTabs = []Tab{
	{"info", "node.tabs.info", "info"},
	{"routing", "node.tabs.routing", "shuffle"},
	{"transports", "node.tabs.transports", "swap_horiz"},
	{"bandwidth", "node.tabs.bandwidth", "equalizer"},
	{"uptime", "node.tabs.uptime", "schedule"},
	{"apps", "node.tabs.apps", "apps"},
	{"chat", "node.tabs.chat", "forum"},
	{"mail", "node.tabs.mail", "mail"},
	{"contacts", "node.tabs.contacts", "contacts"},
	{"rewards", "node.tabs.rewards", "monetization_on"},
	{"dmsg", "node.tabs.dmsg", "device_hub"},
	{"skynet", "node.tabs.skynet", "public"},
	{"web-proxy", "node.tabs.web-proxy", "language"},
	{"vpn", "node.tabs.vpn", "vpn_lock"},
	{"resources", "node.tabs.resources", "memory"},
	{"terminal", "node.tabs.terminal", "code"},
	{"wallet", "node.tabs.wallet", "account_balance_wallet"},
	{"logs", "node.tabs.logs", "description"},
	{"settings", "node.tabs.settings", "tune"},
}

VisorTabs follows the Angular UI's node tabs (static/skywire-manager-src/src/app/utils/node-tabs.ts), with the DMSG tab that Angular reaches by route. A tab without its own ui2 route renders a link to the classic one.

Functions

func Addrs

func Addrs(s string) []string

Addrs splits an address field on commas, semicolons and spaces.

func AlertsPanel

func AlertsPanel(a Alerts) templ.Component

func AppFlagsForm

func AppFlagsForm(v AppFlagsView) templ.Component

AppFlagsForm edits an app's flags one by one instead of as a raw args line. Saving rewrites the launcher args.

func AppHelp

func AppHelp(text, errMsg string) templ.Component

AppHelp is an app's --help output.

func AppLogs

func AppLogs(pk, name string, lines []string, errMsg string) templ.Component

AppLogs is the recent log of one app.

func AppSettings

func AppSettings(pk string, x App, errMsg string) templ.Component

AppSettings is the settings form of one app: its args, environment, launcher mode and autostart, as the Angular settings panel edits them.

func AppsPage

func AppsPage(a Apps) templ.Component

AppsPage is the apps tab: the lists, and a panel for one app's settings or logs.

func AppsRows

func AppsRows(a Apps) templ.Component

AppsRows is both lists. It polls itself so a started app shows as running.

func AppsRowsOOB

func AppsRowsOOB(a Apps) templ.Component

AppsRowsOOB is AppsRows as an out of band swap.

func ArgsString

func ArgsString(args []string) string

ArgsString joins args into one shell-like line, quoting the ones with spaces or quotes, as app-settings.component.ts does.

func Asset

func Asset(name string) string

Asset is the URL of a static file, relative to the page's <base>, carrying its content hash so it can be cached for good.

func AssetVersion

func AssetVersion(name string) string

AssetVersion is the content hash of a static file, or "" if there is none.

func BandwidthBody

func BandwidthBody(b Bandwidth) templ.Component

BandwidthBody polls every 30 seconds as the Angular tab does.

func BandwidthPage

func BandwidthPage(b Bandwidth) templ.Component

BandwidthPage is the bandwidth tab.

func BaseFor

func BaseFor(path string) string

BaseFor is the relative path from the request path back to the root. Every URL in a page is relative to it, so pages keep working under the /vnet/<port>/ prefix the in-tab visor's service worker adds.

func BuildFlagArgs

func BuildFlagArgs(args []string, flags []visorapi.AppFlag, values map[string]string, set map[string]bool) []string

BuildFlagArgs rewrites args with the given flag values: leading positional args and tokens that are not known flags stay, every known flag is dropped, then each flag in set is written back, as buildFlagArgs in app-flags.ts does.

func BulkAction

func BulkAction(a string) bool

BulkAction reports whether a is one of the bulk actions.

func BulkBar

func BulkBar() templ.Component

BulkBar is the selection bar of the visor list. ui2.js shows it while visors are ticked and keeps one hidden pk input per ticked visor in it.

func BulkPanel

func BulkPanel(b Bulk) templ.Component

BulkPanel is the form of a bulk action, or its result once it ran.

func BulkTitle

func BulkTitle(action string) string

BulkTitle is the translation key of the panel's heading.

func BwDetail

func BwDetail(r BwRow) templ.Component

BwDetail is one transport's live snapshot and daily history.

func Bytes

func Bytes(n uint64) string

Bytes prints a byte count with a binary unit.

func CatalogBody

func CatalogBody(c AppCatalog) templ.Component

CatalogBody is the grouped catalog. It polls itself like the app list.

func CatalogPage

func CatalogPage(c AppCatalog) templ.Component

CatalogPage is the apps tab's catalog view: every app the visor can run, with its configured instances.

func ChatLog

func ChatLog(c Chat) templ.Component

ChatLog is the conversation with c.Peer. It polls itself and the peer list.

func ChatPage

func ChatPage(c Chat) templ.Component

ChatPage is the chat tab: direct messages or the group rooms.

func ChatPassword

func ChatPassword(c Chat) templ.Component

ChatPassword sets, changes or removes the password of skychat's standalone page, as the Angular chat tab's password panel.

func ChatPeers

func ChatPeers(c Chat, oob bool) templ.Component

ChatPeers is the conversation list.

func ChatRoomLog

func ChatRoomLog(c Chat) templ.Component

ChatRoomLog is a room's messages. It polls itself.

func ChatRooms

func ChatRooms(c Chat, oob bool) templ.Component

ChatRooms is the room list with the create and join forms.

func ChatVoice

func ChatVoice(v Voice) templ.Component

ChatVoice is the call strip above the conversation: ringing calls, the call being placed, and the call in progress with its level meter, mute buttons and timer. It polls itself; a visor without voice shows nothing.

func ClassicURL

func ClassicURL(pk, seg string) string

ClassicURL is the Angular UI's route for the same visor tab.

func ConfigEdit

func ConfigEdit(pk, raw, errMsg string) templ.Component

ConfigEdit is the runtime config in a text area.

func ConfigView

func ConfigView(pk, raw, msg string) templ.Component

ConfigView shows the runtime config, read only.

func ContactsPage

func ContactsPage(l List) templ.Component

ContactsPage is the contacts tab. Fragments below replace parts of it.

func Count

func Count(n int, oob bool) templ.Component

func DmsgClients

func DmsgClients(d Dmsg) templ.Component

DmsgClients lists each client's sessions, refreshed every 5 seconds as the Angular tab does.

func DmsgOf

DmsgOf lists the clients a visor runs, main first.

func DmsgPage

func DmsgPage(d Dmsg) templ.Component

DmsgPage is the dmsg tab.

func DmsgResult

func DmsgResult(d Dmsg) templ.Component

DmsgResult is the outcome of connect-all or of a new sessions_count.

func EndpointURL

func EndpointURL(u string) string

EndpointURL is the service's /health URL.

func EnvLines

func EnvLines(s string) []string

EnvLines is the non-blank lines of the environment textarea.

func ErrorBox

func ErrorBox(msg string) templ.Component

ErrorBox shows an error the page could not avoid, such as a visor that did not answer.

func FlagDefault

func FlagDefault(f visorapi.AppFlag) string

FlagDefault is the flag's default as the form shows it. An empty list reads "[]" in pflag help output.

func FleetPct

func FleetPct(p float64) string

FleetPct prints a percentage as the Angular page does.

func FleetTpsBody

func FleetTpsBody(f FleetTps) templ.Component

FleetTpsBody polls every 5 minutes as the Angular page does.

func FleetTpsPage

func FleetTpsPage(f FleetTps) templ.Component

func FleetUptimeBody

func FleetUptimeBody(f FleetUptime) templ.Component

FleetUptimeBody refreshes every minute, as the Angular page does.

func FleetUptimePage

func FleetUptimePage(f FleetUptime) templ.Component

FleetUptimePage is the uptime of every visor.

func Folder

func Folder(s string) string

Folder is a known folder name, INBOX for anything else.

func FormView

func FormView(f Form) templ.Component

FormView is the panel in edit mode.

func GroupsView

func GroupsView(groups []Group, errMsg string) templ.Component

GroupsView is the active route groups table.

func HVSettingsPage

func HVSettingsPage(canChangePassword bool) templ.Component

HVSettingsPage is the hypervisor's own settings, the Angular /settings page: theme, refresh rate, password and the saved labels.

func HealthClass

func HealthClass(s string) string

HealthClass names a health value: ok, bad, or still waiting.

func HostUptime

func HostUptime(s uint64) string

HostUptime prints seconds as days, hours and minutes.

func InfoLive

func InfoLive(i Info) templ.Component

InfoLive is the part of the info tab that refreshes itself.

func InfoPage

func InfoPage(i Info) templ.Component

InfoPage is the info tab: the live overview, then the visor's ports, router settings and runtime config, and the restart and turn off actions.

func LastDays

func LastDays(now time.Time, n int) []string

LastDays is the last n UTC dates, newest first.

func Latency

func Latency(d time.Duration) string

Latency prints a dmsg server's latency, or "" when not measured.

func LatencyClass

func LatencyClass(d time.Duration) string

LatencyClass marks slow servers the way the Angular tab does.

func Layout

func Layout(title, classic string) templ.Component

Layout is the whole document around a page. classic is the same page's route in the Angular UI.

func ListSearch

func ListSearch(url, target, scope, placeholder string, q ListQuery) templ.Component

ListSearch is the filter box of a paged list. scope holds the box and the list, so a redraw keeps the sort and the page asks for page one.

func ListState

func ListState(p Pager) templ.Component

ListState carries the sort and page of a paged list into the next request.

func ListText

func ListText(pks []cipher.PubKey, def bool) string

ListText is a helper or relay list for its textarea: empty for the default, "none" for an empty list.

func ListView

func ListView(l List) templ.Component

ListView is the panel in list mode: the bar and the rows.

func LogBody

func LogBody(l Logs) templ.Component

LogBody is the list and its poller, swapped whole when a filter changes.

func LogMore

func LogMore(l Logs) templ.Component

LogMore is one poll: the new entries, appended out of band, and the next poller.

func LoginPage

func LoginPage(create bool, errMsg string) templ.Component

LoginPage logs in, or with create set makes the first account. It posts as a plain form, so it works before any script has loaded.

func LogsPage

func LogsPage(l Logs) templ.Component

LogsPage is the runtime log viewer.

func MailAPI

func MailAPI(pk, folder, id, rest string) string

MailAPI is a JSON mail route for a message, such as its raw download.

func MailBody

func MailBody(m Mail) templ.Component

MailBody is the whole tab below the tab bar. Every action swaps it, so the counts in the folder bar stay current.

func MailPage

func MailPage(m Mail) templ.Component

MailPage is the mail tab.

func MailURL

func MailURL(pk, rest string, kv ...string) string

MailURL is a mail tab URL with query pairs.

func MarkOutdated

func MarkOutdated(ns []Node)

MarkOutdated flags every visor, nested ones included, that runs an older version than the newest one in the list.

func Millis

func Millis(d time.Duration) string

Millis prints a duration as whole milliseconds, or "" for zero.

func MinHops

func MinHops(pk, minHops string, edit bool, errMsg string) templ.Component

MinHops shows the visor's minimum hops, or with edit set the form that changes it.

func NetViewBody

func NetViewBody(v NetView) templ.Component

NetViewBody polls every 5 minutes, as the visor caches the view that long.

func NetViewPage

func NetViewPage(v NetView) templ.Component

func NextInstanceName

func NextInstanceName(e visorapi.CatalogEntry) string

NextInstanceName is the first free name-N for another instance of e.

func NodeRows

func NodeRows(ns []Node, errMsg string, oob bool) templ.Component

NodeRows is the table, which polls itself every 10 seconds as the Angular list does by default. ui2.js applies the Angular UI's labels and the filter after every swap.

func NodesPage

func NodesPage(ns []Node, errMsg string) templ.Component

NodesPage is the list of visors this hypervisor manages.

func NotPorted

func NotPorted(pk, seg string) templ.Component

NotPorted stands in for a tab the new UI does not have yet.

func PKLines

func PKLines(pks []cipher.PubKey) string

PKLines is keys one per line.

func PagerNav

func PagerNav(p Pager, url, target string) templ.Component

PagerNav shows which rows are on screen and moves between pages.

func ParsePKList

func ParsePKList(s string) ([]cipher.PubKey, error)

ParsePKList reads one key per line or comma separated.

func PasswordForm

func PasswordForm(errMsg string) templ.Component

PasswordForm changes the admin password through /api/change-password.

func PathView

func PathView(q PathQuery) templ.Component

PathView is the route find or the route calculation form, with the paths it returned.

func Pct

func Pct(p float64) string

Pct prints a percentage with one decimal.

func PctClass

func PctClass(p float64) string

PctClass colors a percentage: good, fair or poor.

func PickLang

func PickLang(cookie, accept string) string

PickLang is the language named by the cookie, else the first supported one in an Accept-Language header, else English.

func PickRefresh

func PickRefresh(cookie string) int

PickRefresh is the cookie's interval if it is one of the choices, else 10.

func PoliciesView

func PoliciesView(p Policies, errMsg string) templ.Component

PoliciesView is the routing policies view.

func Protocol

Protocol is how the client reached server pk, or "".

func RSNStats

func RSNStats(rows []RSNRow) templ.Component

RSNStats is the route setup nodes' stats.

func Rate

func Rate(bps float64) string

Rate prints bytes per second, or "-" when unknown.

func ResourceRows

func ResourceRows(rows []ResRow, sampled string) templ.Component

ResourceRows polls itself every 5 seconds as the Angular page does.

func ResourcesPage

func ResourcesPage(rows []ResRow, sampled string) templ.Component

ResourcesPage is the host resources of every visor this hypervisor manages.

func RewardAddress

func RewardAddress(rw Rewards) templ.Component

RewardAddress shows the address, and with Editing set the form for it.

func RewardHistoryView

func RewardHistoryView(h RewardHistory) templ.Component

RewardHistoryView is what the reward system paid the visor.

func RewardRules

func RewardRules(text string) templ.Component

RewardRules is the binary's own copy of the reward rules.

func RewardsListPage

func RewardsListPage(l RewardsList) templ.Component

func RewardsPage

func RewardsPage(rw Rewards) templ.Component

RewardsPage is the rewards tab: the reward address, the rules, and the reward system's history of the visor, loaded after the page.

func RoleKey

func RoleKey(role string) string

RoleKey names a dmsg client's role, as the Angular tab words it.

func RouterForm

func RouterForm(pk string, s *visorapi.RouterSettings, errMsg string) templ.Component

RouterForm edits the visor-wide dial settings.

func RoutingPage

func RoutingPage(pk string, minHops string, view string) templ.Component

RoutingPage is the routing tab: the min hops setting, then one sub view.

func Rows

func Rows(l List) templ.Component

Rows is the table the filter swaps.

func RulesList

func RulesList(r Rules) templ.Component

RulesList is one page of the routing rules table.

func RulesView

func RulesView(r Rules) templ.Component

RulesView is the routing rules view: the filter box and the list.

func SameRelease

func SameRelease(version, configVersion string) bool

SameRelease reports whether a visor version and the version that wrote its config are one release: a build adds its commit to the version the config records, which is not a mismatch.

func ServerPicker

func ServerPicker(p ServerPick) templ.Component

func ServiceDrill

func ServiceDrill(service, body, errMsg string) templ.Component

ServiceDrill is a service's /health payload.

func ServiceUptimes

func ServiceUptimes(rows []ServiceUptime) templ.Component

ServiceUptimes is the per-service table, loaded after the page.

func ServicesBody

func ServicesBody(s Services) templ.Component

ServicesBody is the summary and the table, polled every 15 seconds as the Angular page does.

func ServicesPage

func ServicesPage(s Services) templ.Component

ServicesPage is the deployment services health page.

func SettingsPage

func SettingsPage(s Settings) templ.Component

SettingsPage is the settings tab.

func SettingsPanel

func SettingsPanel(s Settings) templ.Component

SettingsPanel is the form, or the review of it.

func ShortTx

func ShortTx(id string) string

ShortTx is the start of a transaction id.

func Size

func Size(n int64) string

Size prints a byte count.

func SkynetBody

func SkynetBody(s Skynet) templ.Component

func SkynetPage

func SkynetPage(s Skynet) templ.Component

func SortNodes

func SortNodes(ns []Node)

SortNodes puts the hypervisor first, then online visors, then by name.

func SortTh

func SortTh(label, key string, p Pager, url, target string, num bool) templ.Component

SortTh is a column head that sorts the list by key.

func Static

func Static() fs.FS

Static is the CSS, JS and htmx the pages load, rooted at static/.

func SvcKey

func SvcKey(name string) string

SvcKey is the svc-fetch key of a service name, or "" for one that cannot be fetched.

func T

func T(ctx context.Context, key string, args ...string) string

T translates key into the page language. args are name, value pairs that fill {{ name }} placeholders, as ngx-translate does.

func TerminalPage

func TerminalPage(pk string) templ.Component

TerminalPage hosts the hypervisor's dmsgpty terminal page.

func TimeOnline

func TimeOnline(ctx context.Context, secs float64) string

TimeOnline is the visor's uptime in the largest whole unit, as the Angular tab words it.

func Toast

func Toast(msg string, isErr bool) templ.Component

func TransportDetails

func TransportDetails(t Transports, x Transport) templ.Component

TransportDetails is one transport's details, as the Angular details dialog shows them.

func TransportsBody

func TransportsBody(t Transports) templ.Component

TransportsBody is the part that polls: one page of the filtered list, and the summary out of band.

func TransportsPage

func TransportsPage(t Transports) templ.Component

TransportsPage is the transports tab: the summary and toggles, the add form and the list.

func TransportsSummary

func TransportsSummary(t Transports, oob bool) templ.Component

TransportsSummary is the count per type and the two switches. The list redraws it out of band, so one poll keeps both current.

func UptimeBars

func UptimeBars(u Uptime) templ.Component

UptimeBars is the window picker and the day bars. It refreshes every minute: the visor samples every five.

func UptimeOf

func UptimeOf(resp *visorapi.LocalUptimeResponse, now time.Time) ([]UpDay, []TierPct)

UptimeOf lays out the visor's tier bitmaps. A '.' slot was up; a slot of today at or after now has not happened yet.

func UptimePage

func UptimePage(u Uptime) templ.Component

UptimePage is the uptime tab: the visor's own tier bitmaps, then what the deployment services recorded of it.

func VPNBody

func VPNBody(v VPN) templ.Component

VPNBody polls every 10 seconds like the app list.

func VPNPage

func VPNPage(v VPN) templ.Component

func VisorError

func VisorError(pk, seg, msg string) templ.Component

VisorError is a visor tab whose visor could not be reached.

func VisorLayout

func VisorLayout(pk, seg string) templ.Component

VisorLayout is a visor page: its key, the tab bar and the tab's card.

func VisorResLive

func VisorResLive(v VisorRes) templ.Component

VisorResLive polls every 3 seconds.

func VisorResourcesPage

func VisorResourcesPage(v VisorRes) templ.Component

VisorResourcesPage is one visor's resources tab.

func VisorURL

func VisorURL(pk, seg string) string

VisorURL is the ui2 URL of a visor tab, relative to the page's <base>.

func WalletPage

func WalletPage(pk, state string) templ.Component

WalletPage hosts skycoin-web's server rendered wallet, forwarded by the hypervisor at wallet/web/, and the coin node settings page.

func WebProxyBody

func WebProxyBody(p WebProxy) templ.Component

func WebProxyPage

func WebProxyPage(p WebProxy) templ.Component

func When

func When(t time.Time) string

When prints a time in local time, or "" for the zero time.

func With

func With(ctx context.Context, p Page, c *Catalog) context.Context

With returns ctx carrying p, rendering with the catalog c.

Types

type Alert

type Alert struct {
	Warn bool
	Text string
}

Alert is one line of the overview's attention list.

type AlertPush

type AlertPush struct {
	ID, Label, Endpoint string
}

AlertPush is one device that gets push alerts.

type AlertResult

type AlertResult struct {
	Channel, Target, Err string
}

AlertResult is how one channel took a test or an alert.

type Alerts

type Alerts struct {
	PK          string
	Emails      string
	Delay       string
	Webhook     string
	From        string
	Relay       bool
	Host        string
	Port        string
	Username    string
	PasswordSet bool
	StartTLS    bool
	Watched     int
	Offline     int
	Push        []AlertPush
	PushKey     string // the VAPID public key a browser subscribes with
	Results     []AlertResult
	Err         string
	Unavailable bool
}

Alerts is the offline alerts form of a visor, as node-alerts.component.ts.

type App

type App struct {
	Name         string
	Status       int
	Detail       string
	Port         string
	AutoStart    bool
	OTP          string
	Args         string
	Env          string
	LauncherMode string
}

App is one row of the apps tab.

func (App) Running

func (a App) Running() bool

Running reports whether the app is up or coming up, as the Angular list tells start from stop.

type AppCatalog

type AppCatalog struct {
	PK     string
	Groups []CatalogGroup
	Err    string
}

AppCatalog is the catalog view of a visor.

func CatalogOf

func CatalogOf(pk string, entries []visorapi.CatalogEntry) AppCatalog

CatalogOf groups the entries by kind, an unknown kind as external, and drops empty groups.

type AppFilter

type AppFilter struct {
	Name, Port, State, Auto string
}

AppFilter is the apps list filter, as the Angular filter dialog: name, port, state ("running" or "stopped") and autostart ("on" or "off").

func AppFilterOf

func AppFilterOf(get func(string) string) AppFilter

AppFilterOf reads the filter from a form.

type AppFlagsView

type AppFlagsView struct {
	PK    string
	App   string
	Flags []FlagRow
	Err   string
}

AppFlagsView is the flags form of one app.

func FlagsViewOf

func FlagsViewOf(pk string, f visorapi.AppFlags) AppFlagsView

FlagsViewOf shows each flag with its value from the launcher args, or its default when the args leave it unset.

type Apps

type Apps struct {
	PK       string
	Official []App
	Other    []App
	Err      string
	// Open is the app whose settings panel is shown.
	Open string
	// Filtered is set when a filter hid some apps.
	Filtered bool
}

Apps is the apps tab: the official apps and the rest, as the Angular tab splits them.

func AppsOf

func AppsOf(pk string, states []*appserver.AppState) Apps

AppsOf sorts the visor's apps into the two lists, by name.

func (Apps) Filter

func (a Apps) Filter(f AppFilter) Apps

Filter keeps the apps f matches.

func (Apps) Find

func (a Apps) Find(name string) (App, bool)

Find is the app named name.

type Bandwidth

type Bandwidth struct {
	PK      string
	Days    int
	Rows    []BwRow
	Pager   Pager
	Total   uint64
	Fetched string
	Err     string
}

Bandwidth is the tab.

func BandwidthOf

func BandwidthOf(pk string, days int, tps []*stats.TransportRecord, now time.Time) Bandwidth

BandwidthOf sums each transport's traffic over the window: the live snapshot for today, the daily rollups since the cutoff otherwise, and sorts the busiest first.

func (Bandwidth) Find

func (b Bandwidth) Find(id string) (BwRow, bool)

Find is the transport with id.

func (Bandwidth) Page

func (b Bandwidth) Page(q ListQuery) Bandwidth

Page keeps the rows that match q and are on its page, 50 to a page.

type Bulk

type Bulk struct {
	Action     string
	Rows       []BulkRow
	Apps       []string
	App        string
	Address    string
	AcceptRisk bool
	StartAfter bool
	Ran        bool
	Err        string
}

Bulk is the bulk action panel: the form before a run and the result after one.

func PlanBulk

func PlanBulk(b Bulk, ns []Node, pks []string, catalog []string) Bulk

PlanBulk lists the selected visors with the reason each one is skipped, as the Angular dialogs do, and the apps the form offers: the catalog and the apps of the selected visors for an add, only the latter otherwise.

func (Bulk) Counts

func (b Bulk) Counts() (ok, failed, skipped int)

Counts are the done, failed and skipped visors of a run.

func (Bulk) Todo

func (b Bulk) Todo() int

Todo is how many visors the action runs on.

type BulkRow

type BulkRow struct {
	PK   string
	Name string
	Skip string
	Err  string
	Done bool
	// AddFirst is an add that must add the app before it can start it.
	AddFirst bool
}

BulkRow is one selected visor and what the action does or did on it. Skip is the translation key of why it is left out.

type BwRow

type BwRow struct {
	*stats.TransportRecord
	Remote string
	Sent   uint64
	Recv   uint64
}

BwRow is one transport.

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

Catalog is the Angular UI's translation files, flattened to dotted keys.

func NewCatalog

func NewCatalog(fsys fs.FS) *Catalog

NewCatalog reads assets/i18n/<lang>.json from fsys as each language is first asked for. A nil fsys gives the keys themselves.

func (*Catalog) Get

func (c *Catalog) Get(lang, key string) string

Get is key in lang, else in English, else the key itself.

type CatalogGroup

type CatalogGroup struct {
	Kind    string
	Entries []visorapi.CatalogEntry
}

CatalogGroup is the catalog entries of one kind.

type Chat

type Chat struct {
	PK     string
	Remote bool
	Mode   string // "dm" or "groups"
	Err    string

	// Direct messages.
	History bool
	Peers   []string
	Peer    string
	Msgs    []ChatMsg
	Draft   string
	ReplyTo string

	// Groups.
	// PwSet is whether the skychat password gates the standalone page.
	PwSet bool
	PwErr string

	Voice Voice

	Groups []visorapi.GroupInfo
	Group  *visorapi.GroupInfo
	GMsgs  []visorapi.GroupMessage
	Invite string
}

Chat is the chat tab.

func ChatOf

func ChatOf(c Chat, ms []ChatMsg) Chat

ChatOf picks the peers, newest conversation first, and peer's messages.

func (Chat) QuoteOf

func (c Chat) QuoteOf(id string) string

QuoteOf is the start of the message a reply points to, or "".

type ChatMsg

type ChatMsg struct {
	Peer     string    `json:"peer"`
	From     string    `json:"from"`
	Outgoing bool      `json:"outgoing"`
	Text     string    `json:"text"`
	Message  string    `json:"message"`
	TS       time.Time `json:"timestamp"`
	ID       string    `json:"id"`
	ReplyTo  string    `json:"reply_to"`
	Deleted  bool      `json:"deleted"`
}

ChatMsg is one direct message.

func ParseChatHistory

func ParseChatHistory(b []byte) ([]ChatMsg, error)

ParseChatHistory reads skychat's /history and sorts it oldest first.

func (ChatMsg) Body

func (m ChatMsg) Body() string

Body is the text, from whichever field skychat filled.

type Dmsg

type Dmsg struct {
	PK      string
	Clients []*visorapi.DmsgClientSessionInfo
	Count   int // the main client's sessions, the form's starting value
	Err     string
	Fetched string
	// Result and Action are the last connect-all or sessions_count outcome.
	Result *visorapi.DmsgConnectAllResult
	Action string
}

Dmsg is the dmsg tab: the visor's dmsg clients and their server sessions.

type Draft

type Draft struct {
	To, Cc, Subject, Body, InReplyTo string
}

Draft is the compose form.

func Reply

func Reply(folder string, m *skymail.Rendered) Draft

Reply fills a draft answering m, as the Angular tab does.

type Field

type Field struct {
	skyenvform.Row
	Draft   string
	Problem string
}

Field is one row of the form with what the user typed.

func FieldsOf

func FieldsOf(rows []skyenvform.Row, drafts map[string]string) ([]Field, int)

FieldsOf pairs the rows with the drafts, the file's values where the form gave none, and the problem each draft has.

func (Field) DefaultLabel

func (f Field) DefaultLabel() string

DefaultLabel is the bool select's default option.

func (Field) FilterText

func (f Field) FilterText() string

FilterText is what the filter box matches a field against.

func (Field) InputType

func (f Field) InputType() string

InputType hides a secret's value.

func (Field) Placeholder

func (f Field) Placeholder() string

Placeholder is a text field's hint while it is empty.

type FlagRow

type FlagRow struct {
	visorapi.AppFlag
	Err string
}

FlagRow is one flag of the form with the value the form shows and why it was refused, if it was.

type FleetRow

type FleetRow struct {
	PK        string
	Online    bool
	Version   string
	Managed   bool
	Runs      []Run
	WindowPct float64
	RecentPct float64
}

FleetRow is one visor's bar.

type FleetSummary

type FleetSummary struct {
	PK       string            `json:"pk"`
	On       bool              `json:"on"`
	Version  string            `json:"version"`
	Daily    map[string]string `json:"daily"`
	Timeline map[string]string `json:"timeline"`
}

FleetSummary is one visor of /api/network/visor-uptime.

type FleetTick

type FleetTick struct {
	Label string
	Left  string
}

FleetTick marks a day boundary along the bars.

type FleetTp

type FleetTp struct {
	ID     string
	Type   string
	Live   bool
	A, B   string
	Sent   uint64
	Recv   uint64
	LatAvg int64 // µs
}

FleetTp is one transport.

type FleetTps

type FleetTps struct {
	Days      int
	Tree      bool
	HideEdges bool
	LiveOnly  bool
	Total     int
	Returned  int
	LiveTotal int
	Bandwidth uint64
	Partial   bool
	Rows      []FleetTp
	Visors    []FleetVisor
	Pager     Pager
	Fetched   string
	Err       string
}

FleetTps is the page.

func FleetTpsOf

func FleetTpsOf(f FleetTps, tps []FleetTp, q ListQuery) FleetTps

FleetTpsOf pages the transports, or in the tree view the visors, the filter text matches.

type FleetUptime

type FleetUptime struct {
	Days     int
	All      bool
	Rows     []FleetRow
	Ticks    []FleetTick
	Err      string
	Fetched  string
	Blocks   int
	Versions VersionHistory
	Managed  int
	Reported int
}

FleetUptime is the page.

func FleetUptimeOf

func FleetUptimeOf(sums []FleetSummary, managed map[string]bool, all bool, days int, now time.Time) FleetUptime

FleetUptimeOf lays out the bars. managed are the visors this hypervisor manages; unless all is set only they are shown.

type FleetVisor

type FleetVisor struct {
	PK      string
	Sent    uint64
	Recv    uint64
	Tps     []FleetTp
	Offline int
}

FleetVisor is one visor of the tree view with its transports.

type Form

type Form struct {
	PK       string
	UID      string
	Name     string
	Keys     string
	Mail     string
	Payments string
	Groups   string
	Notes    string
	Err      string
}

Form is the edit form, with list fields as one entry per line.

func FormOf

func FormOf(pk string, c contacts.Contact) Form

FormOf fills the form from a contact.

func (Form) Contact

func (f Form) Contact() (contacts.Contact, error)

Contact parses the form back into a contact.

type Group

type Group struct {
	Initiator  bool
	Remote     string
	Ports      string
	FwdRID     string
	ConsumeRID string
	Hops       int
	NextTP     string
}

Group is one active route group row.

func GroupsOf

func GroupsOf(gs []visorapi.RouteGroupInfo) []Group

GroupsOf turns the visor's route groups into rows.

type Hypervisor

type Hypervisor struct {
	PK    string
	Local bool   // the hypervisor serving this page
	State string // connected, disconnected or runtime
}

Hypervisor is one hypervisor key the visor knows, and how.

type Info

type Info struct {
	PK        string
	Sum       visorapi.Summary
	Err       string
	Ports     []KV
	Router    *visorapi.RouterSettings
	RouterErr string
}

Info is the info tab: the visor's summary and the settings shown under it.

func (Info) Alerts

func (i Info) Alerts(ctx context.Context) []Alert

Alerts follows overviewAlerts of the Angular overview.

func (Info) AppCounts

func (i Info) AppCounts() (running, autostart, failed int)

AppCounts is how many apps run, start with the visor, and failed.

func (Info) Directions

func (i Info) Directions() (in, out int)

Directions counts incoming and outgoing transports.

func (Info) Hypervisors

func (i Info) Hypervisors(local string) []Hypervisor

Hypervisors merges the configured and the connected hypervisors.

func (Info) MeshName

func (i Info) MeshName() string

MeshName is the visor's .skynet and .dmsg host name.

func (Info) TransportTypes

func (i Info) TransportTypes() []TypeCount

TransportTypes counts the transports by type, most first.

func (Info) Version

func (i Info) Version() string

Version is the running build's version, or "".

type KV

type KV struct{ Name, Value string }

KV is one extra field of a log line.

func PortRows

func PortRows(ports map[string]visorapi.PortDetail) []KV

PortRows sorts the visor's ports for display.

type Lang

type Lang struct {
	Code string
	Name string
}

Lang is a language the pages offer.

type List

type List struct {
	PK     string
	All    []contacts.Contact
	Filter string
	Err    string
}

List is the contact list view.

func (List) Shown

func (l List) Shown() []contacts.Contact

Shown is the contacts whose name, key, mail address or group contains the filter, as the Angular tab matched them.

type ListQuery

type ListQuery struct {
	Q    string
	Sort string
	Desc bool
	Page int
}

ListQuery is the filter text, sort column and page a long list was asked for. The pages send it back with every request that redraws the list.

func ParseListQuery

func ParseListQuery(get func(string) string) ListQuery

ParseListQuery reads q, sort, desc and page through get, which is usually a request's FormValue.

func (ListQuery) Match

func (q ListQuery) Match(fields ...string) bool

Match reports whether the filter text is in any of fields, ignoring case.

type LogEntry

type LogEntry struct {
	Time   string
	Level  LogLevel
	Msg    string
	Func   string
	Module string
	Extra  []KV
}

LogEntry is one runtime log line.

func FilterLogs

func FilterLogs(raws []string, f LogFilter) (out []LogEntry, more bool)

FilterLogs parses raw lines and keeps those f matches, the last LogMax.

func ParseLogEntry

func ParseLogEntry(raw string) (LogEntry, bool)

ParseLogEntry decodes one JSON log line. ok is false for a malformed one.

func (LogEntry) LevelClass

func (e LogEntry) LevelClass() string

LevelClass is the CSS class for the level chip.

func (LogEntry) LevelName

func (e LogEntry) LevelName() string

LevelName is the level as the chip shows it.

type LogFilter

type LogFilter struct {
	MinLevel LogLevel
	Module   string
	Text     string
	Paused   bool
	// contains filtered or unexported fields
}

LogFilter is the level, module and text filter of the tab.

func ParseLogFilter

func ParseLogFilter(q url.Values) (LogFilter, error)

ParseLogFilter reads the filter from a query. A bad module regex is returned as the error and filters nothing.

func (LogFilter) Match

func (f LogFilter) Match(e LogEntry) bool

Match reports whether e passes the filter.

func (LogFilter) Query

func (f LogFilter) Query(extra ...string) string

Query is the filter as URL query parameters, with extra pairs appended.

type LogLevel

type LogLevel int

LogLevel orders log levels as the Angular logs tab does.

const (
	LevelUnknown LogLevel = iota + 1
	LevelTrace
	LevelDebug
	LevelInfo
	LevelWarn
	LevelError
	LevelFatal
	LevelPanic
)

The levels, lowest first.

type Logs

type Logs struct {
	PK      string
	Filter  LogFilter
	Entries []LogEntry
	Cursor  int64
	Dropped int64
	Total   int64
	More    bool // older entries were cut to LogMax
	Err     string
}

Logs is a batch of entries for the tab.

type Mail

type Mail struct {
	PK        string
	Status    *visorapi.MailStatus
	StatusErr string
	Folder    string
	View      string
	List      []skymail.Summary
	Msg       *skymail.Rendered
	MsgID     string
	Queue     *skymail.Queued
	Draft     Draft
	Report    []skymail.RcptResult
	Err       string
}

Mail is what the mail tab shows. View is "list", "message", "compose" or "settings".

type NetView

type NetView struct {
	Rows    []netview.Entry
	Pager   Pager
	Country string
	Version string
	Min     int
	All     bool
	Online  int
	Offline int
	NotInUT int
	Total   int
	Fetched string
	Err     string
}

NetView is the network view, as network-view.component.ts: every visor the service discovery, transport discovery and uptime tracker know of.

func NetViewOf

func NetViewOf(es []netview.Entry, q ListQuery, country, version string, minT int, all bool) NetView

NetViewOf counts the totals and keeps the rows the filters match, 100 to a page.

type Node

type Node struct {
	PK       string
	Hostname string
	Version  string
	Online   bool
	// State is the hypervisor's state for the visor, see alerts.State.
	State       string
	HV          bool
	PublicIP    string
	LocalIP     string
	Location    string
	Transports  int
	Apps        int
	AppNames    []string
	AppsRunning int
	Routes      int
	DmsgServer  string
	DmsgPing    string
	PingMS      int
	Reward      string
	LastSeen    string
	// Outdated is a version older than the newest one in the list.
	Outdated bool

	// ViaSub is a visor only a sub-hypervisor manages, so its pages do not
	// open here. Children are the visors of a sub-hypervisor, and SubErr
	// why they could not be listed.
	ViaSub   bool
	Children []Node
	SubErr   string
}

Node is one row of the visor list.

func NodeOf

func NodeOf(s visorapi.Summary) Node

NodeOf turns a visor summary into a row.

func (Node) Held

func (n Node) Held() bool

Held reports a visor that is not online but not offline either: it is reconnecting, restarting or detached.

func (Node) Name

func (n Node) Name() string

Name is the hostname, else an IP, as the Angular UI's default label.

func (Node) SearchText

func (n Node) SearchText() string

SearchText is what the list's search box matches, in lower case.

func (Node) ShortVersion

func (n Node) ShortVersion() string

ShortVersion is the release part of a version such as v1.3.104-76-gc08475bdb, which fits the list on one line.

func (Node) VersionKey

func (n Node) VersionKey() string

VersionKey sorts versions as text, oldest first, and unknown ones first.

type Page

type Page struct {
	Base   string
	Lang   string
	Auth   bool
	HVPK   string
	Remote bool
	TPViz  bool
	// Refresh is how often, in seconds, the visor list polls.
	Refresh int
	// contains filtered or unexported fields
}

Page is what every page and fragment needs to render: where the root is, the language, and whether there is a session to log out of.

func From

func From(ctx context.Context) *Page

From is the Page in ctx, or an English page rooted at "./".

type Pager

type Pager struct {
	ListQuery
	Total int
	Size  int
}

Pager is one page of a filtered list.

func Paginate

func Paginate[T any](rows []T, q ListQuery, size int) ([]T, Pager)

Paginate keeps the rows of the page q asks for, moving an out of range page to the nearest one.

func (Pager) From

func (p Pager) From() int

From is the 1 based index of the page's first row, 0 for an empty list.

func (Pager) Pages

func (p Pager) Pages() int

Pages is the number of pages, at least one.

func (Pager) To

func (p Pager) To() int

To is the 1 based index of the page's last row.

type Path

type Path struct {
	Hops []string
	Dst  string
}

Path is one route a route find or calculation returned: the visors it passes, ending at the destination.

type PathQuery

type PathQuery struct {
	PK      string
	Calc    bool
	Dst     string
	MinHops string
	MaxHops string
	Count   string
	Paths   []Path
	Ran     bool
	Err     string
}

PathQuery is a route find or calculation form and its answer.

type Policies

type Policies struct {
	Default *visorapi.RoutingPolicyInfo
	Apps    []string
	PerApp  map[string]*visorapi.RoutingPolicyInfo
}

Policies is the routing policies view.

func PoliciesOf

PoliciesOf sorts the per-app policies by app name.

type RSNFailure

type RSNFailure struct {
	Reason string
	Count  uint64
}

RSNFailure is a failure reason and how often it happened.

func TopFailures

func TopFailures(m map[string]uint64) []RSNFailure

TopFailures keeps the three most frequent reasons.

type RSNRow

type RSNRow struct {
	PK             string
	Err            string
	StatsAvailable bool
	Rate           float64
	Successful     uint64
	Failed         uint64
	Active         int
	P50            int64
	P95            int64
	P99            int64
	LastSuccess    string
	LastFailure    string
	Failures       []RSNFailure
}

RSNRow is one route setup node's remote /stats.

type ResRow

type ResRow struct {
	Node
	Stats *visorapi.HostStatsInfo
	Err   string
	// TxRate and RxRate are bytes per second since the previous sample,
	// negative before there is one.
	TxRate float64
	RxRate float64
}

ResRow is one visor's host stats.

type RewardDay

type RewardDay struct {
	Date   string  `json:"date"`
	Amount float64 `json:"amount"`
	Share  float64 `json:"share"`
	Sent   bool    `json:"sent"`
	TxID   string  `json:"txid,omitempty"`
}

RewardDay is one day of the reward system's history for a visor.

func ParseRewardHistory

func ParseRewardHistory(body []byte) ([]RewardDay, float64, error)

ParseRewardHistory reads the reward system's visor history answer.

func (RewardDay) DateLabel

func (d RewardDay) DateLabel() string

DateLabel prints the day like "Nov 3, 2026".

func (RewardDay) Status

func (d RewardDay) Status() string

Status is a day's state as the Angular tab classes it.

type RewardHistory

type RewardHistory struct {
	PK    string
	Days  int
	List  []RewardDay
	Total float64
	Err   string
}

RewardHistory is the history part of the rewards tab.

type RewardRow

type RewardRow struct {
	Node
	Daily map[string]RewardDay
	Total float64
	Err   string
}

RewardRow is one visor of the rewards view.

type Rewards

type Rewards struct {
	PK      string
	Address string
	Xpub    bool
	// Addresses are the first the xpub derives, where its rewards go.
	Addresses []string
	XpubErr   string
	// Spent: the address has sent coins, so its public key is on chain.
	Spent   bool
	Balance string
	Err     string
	Editing bool
	// AcceptRisk keeps the single address box ticked when a save fails.
	AcceptRisk bool
	Draft      string
}

Rewards is the reward address part of the rewards tab.

type RewardsList

type RewardsList struct {
	Dates []string // newest first
	Rows  []RewardRow
}

RewardsList is the visor list's rewards view, as node-list.component.ts with showRewardsInfo: each visor's reward address and its rewards of the last seven days.

type Rule

type Rule struct {
	Key        string
	Type       string
	LocalPort  string
	RemotePK   string
	RemotePort string
	NextRID    string
	NextTP     string
	KeepAlive  string
}

Rule is one routing rule row.

func RulesOf

func RulesOf(rules []routing.Rule) []Rule

RulesOf turns the visor's rules into rows, by key.

type Rules

type Rules struct {
	PK    string
	Total int
	Rows  []Rule
	Pager Pager
	Err   string
}

Rules is one page of the routing rules view.

func SelectRules

func SelectRules(pk string, all []Rule, q ListQuery, errMsg string) Rules

SelectRules filters, sorts and pages rules for q.

type Run

type Run struct {
	State    string
	N        int
	From, To string
}

Run is a stretch of slots in one state: on, off or future.

type ServerPick

type ServerPick struct {
	PK      string
	App     string
	VPN     bool
	Rows    []ServerRow
	Total   int
	Q       string
	Current string
	Err     string
}

ServerPick is the picker.

func FilterServers

func FilterServers(p ServerPick, all []ServerRow) ServerPick

FilterServers keeps the servers q matches, by country then key, at most 200 of them.

type ServerRow

type ServerRow struct {
	PK      string
	Country string
}

ServerRow is one public server.

type ServiceUptime

type ServiceUptime struct {
	Service string
	Days    []TierPct // Name is the date; newest first
	Err     string
}

ServiceUptime is one deployment service's daily uptime of the visor.

type Services

type Services struct {
	Entries []visorapi.ServiceHealthEntry
	Err     string
	Checked string
}

Services is the health of the deployment services this visor uses.

func (Services) AnyDown

func (s Services) AnyDown() bool

AnyDown reports a service whose status is not OK.

type Settings

type Settings struct {
	PK       string
	Path     string
	Exists   bool
	Writable bool
	Fields   []Field
	Err      string

	Reviewing bool
	Changes   []skyenvform.Change
	Command   string
	Saved     bool
}

Settings is the settings tab: the visor's skywire.conf as a form, and the review of what a filled-in form changes.

type Skynet

type Skynet struct {
	PK       string
	Ports    []visorapi.ForwardedPort
	Forwards []SkynetForward
	Err      string
}

Skynet is the skynet tab, as skynet.component.ts: the ports this visor forwards and the reverse proxies it holds open to other visors' ports.

type SkynetForward

type SkynetForward struct {
	ID         string
	Network    string `json:"network"`
	RemotePK   string `json:"remote_pk"`
	RemotePort int    `json:"remote_port"`
	LocalPort  int    `json:"local_port"`
}

SkynetForward is one open reverse proxy.

type Tab

type Tab struct {
	Seg   string
	Label string
	Icon  string
}

Tab is one entry of the per-visor navigation.

func TabOf

func TabOf(seg string) (Tab, bool)

TabOf is the tab with segment seg.

type TierPct

type TierPct struct {
	Name string
	Pct  float64
}

TierPct is a tier's share of known slots online over the window.

func ParseServiceUptimes

func ParseServiceUptimes(body []byte, pk string) ([]TierPct, error)

ParseServiceUptimes picks the visor's daily percentages out of a service's /uptimes?v=v2 answer, keeping the newest seven days.

type Transport

type Transport struct {
	ID         string
	Remote     string
	Type       string
	Label      string
	Latency    string
	Throughput string
	Sent       string
	Recv       string
	Persistent bool
	Offline    bool
	// contains filtered or unexported fields
}

Transport is one row of the transports tab. A persistent transport that is not up has no ID and Offline set, as the Angular list shows it.

type Transports

type Transports struct {
	PK          string
	List        []Transport
	Rows        []Transport
	Pager       Pager
	ByType      []TypeCount
	Types       []string
	Autoconnect bool
	Public      bool
	Err         string
}

Transports is the transports tab.

func TransportsOf

func TransportsOf(pk string, tps []*visorapi.TransportSummary, persistent []transport.PersistentTransports) Transports

TransportsOf builds the tab from the visor's transports and its persistent list.

func (Transports) Online

func (t Transports) Online() int

Online is the number of transports that are up.

func (*Transports) Select

func (t *Transports) Select(q ListQuery)

Select filters, sorts and pages the list for q into Rows and Pager.

func (Transports) TypeSummary

func (t Transports) TypeSummary() string

TypeSummary is the count per type, as "dmsg: 3, stcpr: 1".

type TypeCount

type TypeCount struct {
	Type  string
	Count int
}

TypeCount is how many transports of one type there are.

type UpDay

type UpDay struct {
	Date  string
	Today bool
	Tiers []UpTier
}

UpDay is one UTC day, newest first.

type UpTier

type UpTier struct {
	Name  string
	Runs  []Run
	Pct   float64
	Empty bool
}

UpTier is one tier's bar for a day, as runs of the same state.

type Uptime

type Uptime struct {
	PK      string
	Days    int // the window, 1, 7 or 30
	List    []UpDay
	Summary []TierPct
	Fetched string
	Err     string
}

Uptime is the uptime tab.

type VPN

type VPN struct {
	PK     string
	Client *App
	Server *App
	Err    string
}

VPN is the vpn tab: the vpn-client and vpn-server apps, as vpn.component.ts.

func VPNOf

func VPNOf(a Apps) VPN

VPNOf picks the two apps out of the visor's apps.

type VersionArea

type VersionArea struct {
	Version string
	Color   string
	Points  string
	Latest  int
}

VersionArea is one version's band of the version history chart.

type VersionHistory

type VersionHistory struct {
	Areas       []VersionArea
	First, Last string
	Mid         string
	LatestTotal int
}

VersionHistory is the stacked chart of how many visors ran each version with at least 75% daily uptime, as the Angular fleet uptime page draws it.

func VersionHistoryOf

func VersionHistoryOf(sums []FleetSummary) VersionHistory

VersionHistoryOf counts each visor once a day toward its version when its daily uptime reached 75%. It is empty with fewer than two days.

type VisorRes

type VisorRes struct {
	PK      string
	Host    *visorapi.HostStatsInfo
	Runtime *visorapi.RuntimeStatsInfo
	HostErr string
	RunErr  string
	TxRate  float64
	RxRate  float64
	Sampled string
}

VisorRes is one visor's resources tab.

type Voice

type Voice struct {
	PK      string
	Peer    string // the open conversation, the callee of the call button
	CanCall bool   // direct message mode
	Off     bool   // the visor has no voice
	Err     string

	Incoming []VoiceRing
	Dialing  []visorapi.VoiceDialingInfo

	// The first active call and what the page keeps of it between polls.
	Call  string
	Since int64 // unix seconds, hypervisor clock, when the page first saw Call
	Secs  int64 // seconds since then
	Mic   bool  // our microphone is muted
	Spk   bool  // the caller is muted
}

Voice is the call strip of the chat tab, as the voice controls of skychat.component.ts. The audio itself is the visor's: a native visor's own device, or the desk's microphone and speaker for the in-tab visor.

type VoiceRing

type VoiceRing struct {
	ID   string
	From string
}

VoiceRing is a ringing inbound call.

func ParseVoiceRing

func ParseVoiceRing(s string) VoiceRing

ParseVoiceRing reads one entry of VoiceIncoming, "<id> from <pk>".

type WebProxy

type WebProxy struct {
	PK     string
	Status *visorapi.EmbeddedProxiesStatus
	Err    string
}

WebProxy is the web proxy tab: the resolving proxies for .dmsg and .skynet, as web-proxy.component.ts.

func (WebProxy) On

func (p WebProxy) On() bool

On is whether the .skynet resolver runs, which the Angular tab's box follows.

func (WebProxy) Upstream

func (p WebProxy) Upstream() string

Upstream is the .skynet resolver's upstream SOCKS5 address.

Jump to

Keyboard shortcuts

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