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
- Variables
- func Addrs(s string) []string
- func AlertsPanel(a Alerts) templ.Component
- func AppFlagsForm(v AppFlagsView) templ.Component
- func AppHelp(text, errMsg string) templ.Component
- func AppLogs(pk, name string, lines []string, errMsg string) templ.Component
- func AppSettings(pk string, x App, errMsg string) templ.Component
- func AppsPage(a Apps) templ.Component
- func AppsRows(a Apps) templ.Component
- func AppsRowsOOB(a Apps) templ.Component
- func ArgsString(args []string) string
- func Asset(name string) string
- func AssetVersion(name string) string
- func BandwidthBody(b Bandwidth) templ.Component
- func BandwidthPage(b Bandwidth) templ.Component
- func BaseFor(path string) string
- func BuildFlagArgs(args []string, flags []visorapi.AppFlag, values map[string]string, ...) []string
- func BulkAction(a string) bool
- func BulkBar() templ.Component
- func BulkPanel(b Bulk) templ.Component
- func BulkTitle(action string) string
- func BwDetail(r BwRow) templ.Component
- func Bytes(n uint64) string
- func CatalogBody(c AppCatalog) templ.Component
- func CatalogPage(c AppCatalog) templ.Component
- func ChatLog(c Chat) templ.Component
- func ChatPage(c Chat) templ.Component
- func ChatPassword(c Chat) templ.Component
- func ChatPeers(c Chat, oob bool) templ.Component
- func ChatRoomLog(c Chat) templ.Component
- func ChatRooms(c Chat, oob bool) templ.Component
- func ChatVoice(v Voice) templ.Component
- func ClassicURL(pk, seg string) string
- func ConfigEdit(pk, raw, errMsg string) templ.Component
- func ConfigView(pk, raw, msg string) templ.Component
- func ContactsPage(l List) templ.Component
- func Count(n int, oob bool) templ.Component
- func DmsgClients(d Dmsg) templ.Component
- func DmsgOf(s *visorapi.DmsgClientSessions) ([]*visorapi.DmsgClientSessionInfo, int)
- func DmsgPage(d Dmsg) templ.Component
- func DmsgResult(d Dmsg) templ.Component
- func EndpointURL(u string) string
- func EnvLines(s string) []string
- func ErrorBox(msg string) templ.Component
- func FlagDefault(f visorapi.AppFlag) string
- func FleetPct(p float64) string
- func FleetTpsBody(f FleetTps) templ.Component
- func FleetTpsPage(f FleetTps) templ.Component
- func FleetUptimeBody(f FleetUptime) templ.Component
- func FleetUptimePage(f FleetUptime) templ.Component
- func Folder(s string) string
- func FormView(f Form) templ.Component
- func GroupsView(groups []Group, errMsg string) templ.Component
- func HVSettingsPage(canChangePassword bool) templ.Component
- func HealthClass(s string) string
- func HostUptime(s uint64) string
- func InfoLive(i Info) templ.Component
- func InfoPage(i Info) templ.Component
- func LastDays(now time.Time, n int) []string
- func Latency(d time.Duration) string
- func LatencyClass(d time.Duration) string
- func Layout(title, classic string) templ.Component
- func ListSearch(url, target, scope, placeholder string, q ListQuery) templ.Component
- func ListState(p Pager) templ.Component
- func ListText(pks []cipher.PubKey, def bool) string
- func ListView(l List) templ.Component
- func LogBody(l Logs) templ.Component
- func LogMore(l Logs) templ.Component
- func LoginPage(create bool, errMsg string) templ.Component
- func LogsPage(l Logs) templ.Component
- func MailAPI(pk, folder, id, rest string) string
- func MailBody(m Mail) templ.Component
- func MailPage(m Mail) templ.Component
- func MailURL(pk, rest string, kv ...string) string
- func MarkOutdated(ns []Node)
- func Millis(d time.Duration) string
- func MinHops(pk, minHops string, edit bool, errMsg string) templ.Component
- func NetViewBody(v NetView) templ.Component
- func NetViewPage(v NetView) templ.Component
- func NextInstanceName(e visorapi.CatalogEntry) string
- func NodeRows(ns []Node, errMsg string, oob bool) templ.Component
- func NodesPage(ns []Node, errMsg string) templ.Component
- func NotPorted(pk, seg string) templ.Component
- func PKLines(pks []cipher.PubKey) string
- func PagerNav(p Pager, url, target string) templ.Component
- func ParsePKList(s string) ([]cipher.PubKey, error)
- func PasswordForm(errMsg string) templ.Component
- func PathView(q PathQuery) templ.Component
- func Pct(p float64) string
- func PctClass(p float64) string
- func PickLang(cookie, accept string) string
- func PickRefresh(cookie string) int
- func PoliciesView(p Policies, errMsg string) templ.Component
- func Protocol(c *visorapi.DmsgClientSessionInfo, pk string) string
- func RSNStats(rows []RSNRow) templ.Component
- func Rate(bps float64) string
- func ResourceRows(rows []ResRow, sampled string) templ.Component
- func ResourcesPage(rows []ResRow, sampled string) templ.Component
- func RewardAddress(rw Rewards) templ.Component
- func RewardHistoryView(h RewardHistory) templ.Component
- func RewardRules(text string) templ.Component
- func RewardsListPage(l RewardsList) templ.Component
- func RewardsPage(rw Rewards) templ.Component
- func RoleKey(role string) string
- func RouterForm(pk string, s *visorapi.RouterSettings, errMsg string) templ.Component
- func RoutingPage(pk string, minHops string, view string) templ.Component
- func Rows(l List) templ.Component
- func RulesList(r Rules) templ.Component
- func RulesView(r Rules) templ.Component
- func SameRelease(version, configVersion string) bool
- func ServerPicker(p ServerPick) templ.Component
- func ServiceDrill(service, body, errMsg string) templ.Component
- func ServiceUptimes(rows []ServiceUptime) templ.Component
- func ServicesBody(s Services) templ.Component
- func ServicesPage(s Services) templ.Component
- func SettingsPage(s Settings) templ.Component
- func SettingsPanel(s Settings) templ.Component
- func ShortTx(id string) string
- func Size(n int64) string
- func SkynetBody(s Skynet) templ.Component
- func SkynetPage(s Skynet) templ.Component
- func SortNodes(ns []Node)
- func SortTh(label, key string, p Pager, url, target string, num bool) templ.Component
- func Static() fs.FS
- func SvcKey(name string) string
- func T(ctx context.Context, key string, args ...string) string
- func TerminalPage(pk string) templ.Component
- func TimeOnline(ctx context.Context, secs float64) string
- func Toast(msg string, isErr bool) templ.Component
- func TransportDetails(t Transports, x Transport) templ.Component
- func TransportsBody(t Transports) templ.Component
- func TransportsPage(t Transports) templ.Component
- func TransportsSummary(t Transports, oob bool) templ.Component
- func UptimeBars(u Uptime) templ.Component
- func UptimeOf(resp *visorapi.LocalUptimeResponse, now time.Time) ([]UpDay, []TierPct)
- func UptimePage(u Uptime) templ.Component
- func VPNBody(v VPN) templ.Component
- func VPNPage(v VPN) templ.Component
- func VisorError(pk, seg, msg string) templ.Component
- func VisorLayout(pk, seg string) templ.Component
- func VisorResLive(v VisorRes) templ.Component
- func VisorResourcesPage(v VisorRes) templ.Component
- func VisorURL(pk, seg string) string
- func WalletPage(pk, state string) templ.Component
- func WebProxyBody(p WebProxy) templ.Component
- func WebProxyPage(p WebProxy) templ.Component
- func When(t time.Time) string
- func With(ctx context.Context, p Page, c *Catalog) context.Context
- type Alert
- type AlertPush
- type AlertResult
- type Alerts
- type App
- type AppCatalog
- type AppFilter
- type AppFlagsView
- type Apps
- type Bandwidth
- type Bulk
- type BulkRow
- type BwRow
- type Catalog
- type CatalogGroup
- type Chat
- type ChatMsg
- type Dmsg
- type Draft
- type Field
- type FlagRow
- type FleetRow
- type FleetSummary
- type FleetTick
- type FleetTp
- type FleetTps
- type FleetUptime
- type FleetVisor
- type Form
- type Group
- type Hypervisor
- type Info
- func (i Info) Alerts(ctx context.Context) []Alert
- func (i Info) AppCounts() (running, autostart, failed int)
- func (i Info) Directions() (in, out int)
- func (i Info) Hypervisors(local string) []Hypervisor
- func (i Info) MeshName() string
- func (i Info) TransportTypes() []TypeCount
- func (i Info) Version() string
- type KV
- type Lang
- type List
- type ListQuery
- type LogEntry
- type LogFilter
- type LogLevel
- type Logs
- type Mail
- type NetView
- type Node
- type Page
- type Pager
- type Path
- type PathQuery
- type Policies
- type RSNFailure
- type RSNRow
- type ResRow
- type RewardDay
- type RewardHistory
- type RewardRow
- type Rewards
- type RewardsList
- type Rule
- type Rules
- type Run
- type ServerPick
- type ServerRow
- type ServiceUptime
- type Services
- type Settings
- type Skynet
- type SkynetForward
- type Tab
- type TierPct
- type Transport
- type Transports
- type TypeCount
- type UpDay
- type UpTier
- type Uptime
- type VPN
- type VersionArea
- type VersionHistory
- type VisorRes
- type Voice
- type VoiceRing
- type WebProxy
Constants ¶
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).
const ( FolderInbox = "INBOX" FolderSent = "Sent" FolderOutbox = "Outbox" )
Mail folders, as the visor names them.
const ( WalletRunning = "running" WalletStopped = "stopped" WalletMissing = "missing" )
The states of the hypervisor's skycoin-web app for the wallet tab.
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.
const LangCookie = "ui2-lang"
LangCookie holds the chosen language. ui2.js keeps it in step with the Angular UI's "lang" localStorage entry.
const ListPageSize = 100
ListPageSize is how many rows a long list renders at once.
const LogMax = 1000
LogMax is how many entries the tab keeps, as the Angular one does.
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 ¶
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.
var CatalogKinds = []string{"server", "client", "service", "external"}
CatalogKinds is the order the groups are shown in.
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).
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.
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).
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.
var UptimeTiers = []string{"process", "dmsg", "skynet"}
UptimeTiers is the order the Angular tab draws the tiers in.
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 AlertsPanel ¶
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 AppSettings ¶
AppSettings is the settings form of one app: its args, environment, launcher mode and autostart, as the Angular settings panel edits them.
func AppsRowsOOB ¶
AppsRowsOOB is AppsRows as an out of band swap.
func ArgsString ¶
ArgsString joins args into one shell-like line, quoting the ones with spaces or quotes, as app-settings.component.ts does.
func Asset ¶
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 ¶
AssetVersion is the content hash of a static file, or "" if there is none.
func BandwidthBody ¶
BandwidthBody polls every 30 seconds as the Angular tab does.
func BandwidthPage ¶
BandwidthPage is the bandwidth tab.
func BaseFor ¶
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 ¶
BulkAction reports whether a is one of the bulk actions.
func BulkBar ¶
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 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 ChatPassword ¶
ChatPassword sets, changes or removes the password of skychat's standalone page, as the Angular chat tab's password panel.
func ChatRoomLog ¶
ChatRoomLog is a room's messages. It polls itself.
func ChatVoice ¶
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 ¶
ClassicURL is the Angular UI's route for the same visor tab.
func ConfigEdit ¶
ConfigEdit is the runtime config in a text area.
func ConfigView ¶
ConfigView shows the runtime config, read only.
func ContactsPage ¶
ContactsPage is the contacts tab. Fragments below replace parts of it.
func DmsgClients ¶
DmsgClients lists each client's sessions, refreshed every 5 seconds as the Angular tab does.
func DmsgOf ¶
func DmsgOf(s *visorapi.DmsgClientSessions) ([]*visorapi.DmsgClientSessionInfo, int)
DmsgOf lists the clients a visor runs, main first.
func DmsgResult ¶
DmsgResult is the outcome of connect-all or of a new sessions_count.
func ErrorBox ¶
ErrorBox shows an error the page could not avoid, such as a visor that did not answer.
func FlagDefault ¶
FlagDefault is the flag's default as the form shows it. An empty list reads "[]" in pflag help output.
func FleetTpsBody ¶
FleetTpsBody polls every 5 minutes as the Angular page does.
func FleetTpsPage ¶
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 GroupsView ¶
GroupsView is the active route groups table.
func HVSettingsPage ¶
HVSettingsPage is the hypervisor's own settings, the Angular /settings page: theme, refresh rate, password and the saved labels.
func HealthClass ¶
HealthClass names a health value: ok, bad, or still waiting.
func HostUptime ¶
HostUptime prints seconds as days, hours and minutes.
func InfoPage ¶
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 LatencyClass ¶
LatencyClass marks slow servers the way the Angular tab does.
func Layout ¶
Layout is the whole document around a page. classic is the same page's route in the Angular UI.
func ListSearch ¶
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 ListText ¶
ListText is a helper or relay list for its textarea: empty for the default, "none" for an empty list.
func LoginPage ¶
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 MailBody ¶
MailBody is the whole tab below the tab bar. Every action swaps it, so the counts in the folder bar stay current.
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 NetViewBody ¶
NetViewBody polls every 5 minutes, as the visor caches the view that long.
func NetViewPage ¶
func NextInstanceName ¶
func NextInstanceName(e visorapi.CatalogEntry) string
NextInstanceName is the first free name-N for another instance of e.
func NodeRows ¶
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 ParsePKList ¶
ParsePKList reads one key per line or comma separated.
func PasswordForm ¶
PasswordForm changes the admin password through /api/change-password.
func PathView ¶
PathView is the route find or the route calculation form, with the paths it returned.
func PickLang ¶
PickLang is the language named by the cookie, else the first supported one in an Accept-Language header, else English.
func PickRefresh ¶
PickRefresh is the cookie's interval if it is one of the choices, else 10.
func PoliciesView ¶
PoliciesView is the routing policies view.
func Protocol ¶
func Protocol(c *visorapi.DmsgClientSessionInfo, pk string) string
Protocol is how the client reached server pk, or "".
func ResourceRows ¶
ResourceRows polls itself every 5 seconds as the Angular page does.
func ResourcesPage ¶
ResourcesPage is the host resources of every visor this hypervisor manages.
func RewardAddress ¶
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 ¶
RewardRules is the binary's own copy of the reward rules.
func RewardsListPage ¶
func RewardsListPage(l RewardsList) templ.Component
func RewardsPage ¶
RewardsPage is the rewards tab: the reward address, the rules, and the reward system's history of the visor, loaded after the page.
func RouterForm ¶
RouterForm edits the visor-wide dial settings.
func RoutingPage ¶
RoutingPage is the routing tab: the min hops setting, then one sub view.
func SameRelease ¶
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 ¶
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 ¶
ServicesBody is the summary and the table, polled every 15 seconds as the Angular page does.
func ServicesPage ¶
ServicesPage is the deployment services health page.
func SettingsPanel ¶
SettingsPanel is the form, or the review of it.
func SkynetBody ¶
func SkynetPage ¶
func SortNodes ¶
func SortNodes(ns []Node)
SortNodes puts the hypervisor first, then online visors, then by name.
func T ¶
T translates key into the page language. args are name, value pairs that fill {{ name }} placeholders, as ngx-translate does.
func TerminalPage ¶
TerminalPage hosts the hypervisor's dmsgpty terminal page.
func TimeOnline ¶
TimeOnline is the visor's uptime in the largest whole unit, as the Angular tab words it.
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 ¶
UptimeBars is the window picker and the day bars. It refreshes every minute: the visor samples every five.
func UptimeOf ¶
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 ¶
UptimePage is the uptime tab: the visor's own tier bitmaps, then what the deployment services recorded of it.
func VisorError ¶
VisorError is a visor tab whose visor could not be reached.
func VisorLayout ¶
VisorLayout is a visor page: its key, the tab bar and the tab's card.
func VisorResLive ¶
VisorResLive polls every 3 seconds.
func VisorResourcesPage ¶
VisorResourcesPage is one visor's resources tab.
func WalletPage ¶
WalletPage hosts skycoin-web's server rendered wallet, forwarded by the hypervisor at wallet/web/, and the coin node settings page.
func WebProxyBody ¶
func WebProxyPage ¶
Types ¶
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
}
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.
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 ¶
AppFilterOf reads the filter from a form.
type AppFlagsView ¶
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.
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 ¶
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.
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 ¶
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.
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 ¶
NewCatalog reads assets/i18n/<lang>.json from fsys as each language is first asked for. A nil fsys gives the keys themselves.
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.
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 ¶
ParseChatHistory reads skychat's /history and sorts it oldest first.
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.
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 ¶
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 ¶
DefaultLabel is the bool select's default option.
func (Field) FilterText ¶
FilterText is what the filter box matches a field against.
func (Field) Placeholder ¶
Placeholder is a text field's hint while it is empty.
type FlagRow ¶
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 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.
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 ¶
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.
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) Directions ¶
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) TransportTypes ¶
TransportTypes counts the transports by type, most first.
type ListQuery ¶
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 ¶
ParseListQuery reads q, sort, desc and page through get, which is usually a request's FormValue.
type LogEntry ¶
LogEntry is one runtime log line.
func FilterLogs ¶
FilterLogs parses raw lines and keeps those f matches, the last LogMax.
func ParseLogEntry ¶
ParseLogEntry decodes one JSON log line. ok is false for a malformed one.
func (LogEntry) LevelClass ¶
LevelClass is the CSS class for the level chip.
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 ¶
ParseLogFilter reads the filter from a query. A bad module regex is returned as the error and filters nothing.
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.
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 (Node) Held ¶
Held reports a visor that is not online but not offline either: it is reconnecting, restarting or detached.
func (Node) SearchText ¶
SearchText is what the list's search box matches, in lower case.
func (Node) ShortVersion ¶
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 ¶
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.
type Pager ¶
Pager is one page of a filtered list.
func Paginate ¶
Paginate keeps the rows of the page q asks for, moving an out of range page to the nearest one.
type Path ¶
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 ¶
func PoliciesOf(s *visorapi.RoutingPoliciesSummary) Policies
PoliciesOf sorts the per-app policies by app name.
type RSNFailure ¶
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"`
Sent bool `json:"sent"`
TxID string `json:"txid,omitempty"`
}
RewardDay is one day of the reward system's history for a visor.
func ParseRewardHistory ¶
ParseRewardHistory reads the reward system's visor history answer.
type RewardHistory ¶
RewardHistory is the history part of the rewards tab.
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 ¶
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.
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 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.
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 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 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 VersionArea ¶
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 ¶
VoiceRing is a ringing inbound call.
func ParseVoiceRing ¶
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.
Source Files
¶
- alerts_templ.go
- apps.go
- apps_templ.go
- bandwidth.go
- bandwidth_templ.go
- bulk.go
- bulk_templ.go
- catalog.go
- catalog_templ.go
- chat.go
- chat_templ.go
- contacts.go
- contacts_templ.go
- dmsg.go
- dmsg_templ.go
- flags.go
- flags_templ.go
- fleettp_templ.go
- fleetuptime.go
- fleetuptime_templ.go
- hvsettings.go
- hvsettings_templ.go
- i18n.go
- info.go
- info_templ.go
- layout_templ.go
- login_templ.go
- logs.go
- logs_templ.go
- mail.go
- mail_templ.go
- netview_templ.go
- nodes.go
- nodes_templ.go
- paging.go
- paging_templ.go
- resources.go
- resources_templ.go
- rewards.go
- rewards_templ.go
- rewardslist_templ.go
- routing.go
- routing_templ.go
- servers_templ.go
- services.go
- services_templ.go
- settings.go
- settings_templ.go
- skynet_templ.go
- tabs.go
- terminal_templ.go
- transports.go
- transports_templ.go
- ui2.go
- uptime.go
- uptime_templ.go
- voice.go
- voice_templ.go
- vpn_templ.go
- wallet_templ.go
- webproxy_templ.go