|
|
@@ -4,21 +4,34 @@ import (
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
+// incoming websocket payloads
|
|
|
type WsPayload struct {
|
|
|
Type string `json:"type"`
|
|
|
Action string `json:"action"`
|
|
|
}
|
|
|
|
|
|
+// eventbus event payloads
|
|
|
type Event struct {
|
|
|
Type string
|
|
|
Data interface{}
|
|
|
}
|
|
|
|
|
|
+// for keeping track of container desired/actual state
|
|
|
+type ContainerState struct {
|
|
|
+ ID string
|
|
|
+ Name string
|
|
|
+ Image string
|
|
|
+ Status string
|
|
|
+ CreatedAt time.Time
|
|
|
+}
|
|
|
+
|
|
|
+// authenticated browser sessions
|
|
|
type SessionInfo struct {
|
|
|
Hash string `json:"hash"`
|
|
|
Created string `json:"created"`
|
|
|
}
|
|
|
|
|
|
+// system.json config struct
|
|
|
type SysConfig struct {
|
|
|
Setup string `json:"setup"`
|
|
|
EndpointUrl string `json:"endpointUrl"`
|
|
|
@@ -56,12 +69,14 @@ type SysConfig struct {
|
|
|
Salt string `json:"salt"`
|
|
|
}
|
|
|
|
|
|
+// broadcast subobject
|
|
|
type LoginStatus struct {
|
|
|
Locked bool
|
|
|
End time.Time
|
|
|
Attempts int
|
|
|
}
|
|
|
|
|
|
+// broadcast subobject
|
|
|
type LoginKeys struct {
|
|
|
Old struct {
|
|
|
Pub string
|
|
|
@@ -73,6 +88,7 @@ type LoginKeys struct {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// version server payload root struct
|
|
|
type Version struct {
|
|
|
Groundseg struct {
|
|
|
Canary Channel `json:"canary"`
|
|
|
@@ -81,6 +97,7 @@ type Version struct {
|
|
|
} `json:"groundseg"`
|
|
|
}
|
|
|
|
|
|
+// version server payload substruct
|
|
|
type Channel struct {
|
|
|
Groundseg VersionDetails `json:"groundseg"`
|
|
|
Manual VersionDetails `json:"manual"`
|
|
|
@@ -92,6 +109,7 @@ type Channel struct {
|
|
|
Wireguard VersionDetails `json:"wireguard"`
|
|
|
}
|
|
|
|
|
|
+// version server payload substruct
|
|
|
type VersionDetails struct {
|
|
|
Amd64Sha256 string `json:"amd64_sha256"`
|
|
|
Amd64URL string `json:"amd64_url,omitempty"`
|
|
|
@@ -104,6 +122,18 @@ type VersionDetails struct {
|
|
|
Tag string `json:"tag,omitempty"`
|
|
|
}
|
|
|
|
|
|
+// broadcast payload object struct
|
|
|
+type AuthBroadcast struct {
|
|
|
+ Type string `json:"type"`
|
|
|
+ AuthLevel string `json:"auth_level"`
|
|
|
+ Upload Upload `json:"upload"`
|
|
|
+ Logs Logs `json:"logs"`
|
|
|
+ System SystemInfo `json:"system"`
|
|
|
+ Profile Profile `json:"profile"`
|
|
|
+ Urbits map[string]Urbit `json:"urbits"`
|
|
|
+}
|
|
|
+
|
|
|
+// broadcast payload subobject
|
|
|
type SystemUsage struct {
|
|
|
RAM []uint64 `json:"ram"`
|
|
|
CPU int `json:"cpu"`
|
|
|
@@ -112,6 +142,7 @@ type SystemUsage struct {
|
|
|
SwapFile int `json:"swap"`
|
|
|
}
|
|
|
|
|
|
+// broadcast payload subobject
|
|
|
type SystemUpdates struct {
|
|
|
Linux struct {
|
|
|
State string `json:"state"`
|
|
|
@@ -122,22 +153,26 @@ type SystemUpdates struct {
|
|
|
} `json:"linux"`
|
|
|
}
|
|
|
|
|
|
+// broadcast payload subobject
|
|
|
type SystemWifi struct {
|
|
|
Status string `json:"status"`
|
|
|
Active string `json:"active"`
|
|
|
Networks []string `json:"networks"`
|
|
|
}
|
|
|
|
|
|
+// broadcast payload subobject
|
|
|
type SystemInfo struct {
|
|
|
Usage SystemUsage `json:"usage"`
|
|
|
Updates SystemUpdates `json:"updates"`
|
|
|
Wifi SystemWifi `json:"wifi"`
|
|
|
}
|
|
|
|
|
|
+// broadcast payload subobject
|
|
|
type Profile struct {
|
|
|
Startram Startram `json:"startram"`
|
|
|
}
|
|
|
|
|
|
+// broadcast payload subobject
|
|
|
type Startram struct {
|
|
|
Info struct {
|
|
|
Registered bool `json:"registered"`
|
|
|
@@ -154,6 +189,7 @@ type Startram struct {
|
|
|
} `json:"transition"`
|
|
|
}
|
|
|
|
|
|
+// broadcast payload subobject
|
|
|
type Urbit struct {
|
|
|
Info struct {
|
|
|
Network string `json:"network"`
|
|
|
@@ -176,6 +212,13 @@ type Urbit struct {
|
|
|
} `json:"transition"`
|
|
|
}
|
|
|
|
|
|
+// used to construct broadcast pier info subobject
|
|
|
+type ContainerStats struct {
|
|
|
+ MemoryUsage uint64
|
|
|
+ DiskUsage int64
|
|
|
+}
|
|
|
+
|
|
|
+// broadcast payload subobject
|
|
|
type Logs struct {
|
|
|
Containers struct {
|
|
|
Wireguard struct {
|
|
|
@@ -188,16 +231,7 @@ type Logs struct {
|
|
|
} `json:"system"`
|
|
|
}
|
|
|
|
|
|
-type AuthBroadcast struct {
|
|
|
- Type string `json:"type"`
|
|
|
- AuthLevel string `json:"auth_level"`
|
|
|
- Upload Upload `json:"upload"`
|
|
|
- Logs Logs `json:"logs"`
|
|
|
- System SystemInfo `json:"system"`
|
|
|
- Profile Profile `json:"profile"`
|
|
|
- Urbits map[string]Urbit `json:"urbits"`
|
|
|
-}
|
|
|
-
|
|
|
+// broadcast payload subobject
|
|
|
type Upload struct {
|
|
|
Status string `json:"status"`
|
|
|
Size int `json:"size"`
|
|
|
@@ -205,6 +239,7 @@ type Upload struct {
|
|
|
Patp any `json:"patp"`
|
|
|
}
|
|
|
|
|
|
+// broadcast payload subobject
|
|
|
type UnauthBroadcast struct {
|
|
|
Type string `json:"type"`
|
|
|
AuthLevel string `json:"auth_level"`
|
|
|
@@ -213,6 +248,7 @@ type UnauthBroadcast struct {
|
|
|
} `json:"login"`
|
|
|
}
|
|
|
|
|
|
+// broadcast payload subobject
|
|
|
type SetupBroadcast struct {
|
|
|
Type string `json:"type"`
|
|
|
AuthLevel string `json:"auth_level"`
|
|
|
@@ -221,11 +257,13 @@ type SetupBroadcast struct {
|
|
|
Regions map[string]StartramRegion `json:"regions"`
|
|
|
}
|
|
|
|
|
|
+// startram region server subobject
|
|
|
type StartramRegion struct {
|
|
|
Country string `json:"country"`
|
|
|
Desc string `json:"desc"`
|
|
|
}
|
|
|
|
|
|
+// pier json struct
|
|
|
type UrbitDocker struct {
|
|
|
PierName string `json:"pier_name"`
|
|
|
HTTPPort int `json:"http_port"`
|
|
|
@@ -258,8 +296,3 @@ type UrbitDocker struct {
|
|
|
DevMode bool `json:"dev_mode"`
|
|
|
Click bool `json:"click"`
|
|
|
}
|
|
|
-
|
|
|
-type ContainerStats struct {
|
|
|
- MemoryUsage uint64
|
|
|
- DiskUsage int64
|
|
|
-}
|