broadcast.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. package structs
  2. // broadcast payload object struct
  3. type AuthBroadcast struct {
  4. Type string `json:"type"`
  5. AuthLevel string `json:"auth_level"`
  6. Upload Upload `json:"upload"`
  7. Logs Logs `json:"logs"`
  8. System SystemInfo `json:"system"`
  9. Profile Profile `json:"profile"`
  10. Urbits map[string]Urbit `json:"urbits"`
  11. }
  12. // broadcast payload subobject
  13. type SystemUsage struct {
  14. RAM []uint64 `json:"ram"`
  15. CPU int `json:"cpu"`
  16. CPUTemp float64 `json:"cpu_temp"`
  17. Disk []uint64 `json:"disk"`
  18. SwapFile int `json:"swap"`
  19. }
  20. // broadcast payload subobject
  21. type SystemUpdates struct {
  22. Linux struct {
  23. State string `json:"state"`
  24. Upgrade int `json:"upgrade"`
  25. New int `json:"new"`
  26. Remove int `json:"remove"`
  27. Ignore int `json:"ignore"`
  28. } `json:"linux"`
  29. }
  30. // broadcast payload subobject
  31. type SystemWifi struct {
  32. Status string `json:"status"`
  33. Active string `json:"active"`
  34. Networks []string `json:"networks"`
  35. }
  36. // broadcast payload subobject
  37. type SystemInfo struct {
  38. Usage SystemUsage `json:"usage"`
  39. Updates SystemUpdates `json:"updates"`
  40. Wifi SystemWifi `json:"wifi"`
  41. }
  42. // broadcast payload subobject
  43. type Profile struct {
  44. Startram Startram `json:"startram"`
  45. }
  46. // broadcast payload subobject
  47. type Startram struct {
  48. Info struct {
  49. Registered bool `json:"registered"`
  50. Running bool `json:"running"`
  51. Region any `json:"region"`
  52. Expiry any `json:"expiry"`
  53. Renew bool `json:"renew"`
  54. Endpoint string `json:"endpoint"`
  55. Regions map[string]StartramRegion `json:"regions"`
  56. } `json:"info"`
  57. Transition struct {
  58. Register any `json:"register"`
  59. Toggle any `json:"toggle"`
  60. } `json:"transition"`
  61. }
  62. // broadcast payload subobject
  63. type Urbit struct {
  64. Info struct {
  65. Network string `json:"network"`
  66. Running bool `json:"running"`
  67. URL string `json:"url"`
  68. UrbAlias bool `json:"urbAlias"`
  69. MemUsage uint64 `json:"memUsage"`
  70. DiskUsage int64 `json:"diskUsage"`
  71. LoomSize int `json:"loomSize"`
  72. DevMode bool `json:"devMode"`
  73. DetectBootStatus bool `json:"detectBootStatus"`
  74. Remote bool `json:"remote"`
  75. Vere any `json:"vere"`
  76. } `json:"info"`
  77. Transition struct {
  78. Meld any `json:"meld"`
  79. ServiceRegistrationStatus string `json:"serviceRegistrationStatus"`
  80. TogglePower any `json:"togglePower"`
  81. DeleteShip any `json:"deleteShip"`
  82. } `json:"transition"`
  83. }
  84. // used to construct broadcast pier info subobject
  85. type ContainerStats struct {
  86. MemoryUsage uint64
  87. DiskUsage int64
  88. }
  89. // broadcast payload subobject
  90. type Logs struct {
  91. Containers struct {
  92. Wireguard struct {
  93. Logs []any `json:"logs"`
  94. } `json:"wireguard"`
  95. } `json:"containers"`
  96. System struct {
  97. Stream bool `json:"stream"`
  98. Logs []any `json:"logs"`
  99. } `json:"system"`
  100. }
  101. // broadcast payload subobject
  102. type Upload struct {
  103. Status string `json:"status"`
  104. Size int `json:"size"`
  105. Uploaded int `json:"uploaded"`
  106. Patp any `json:"patp"`
  107. }
  108. // broadcast payload subobject
  109. type UnauthBroadcast struct {
  110. Type string `json:"type"`
  111. AuthLevel string `json:"auth_level"`
  112. Login struct {
  113. Remainder int `json:"remainder"`
  114. } `json:"login"`
  115. }
  116. // broadcast payload subobject
  117. type SetupBroadcast struct {
  118. Type string `json:"type"`
  119. AuthLevel string `json:"auth_level"`
  120. Stage string `json:"stage"`
  121. Page string `json:"page"`
  122. Regions map[string]StartramRegion `json:"regions"`
  123. }
  124. // broadcast subobject
  125. type LoginStatus struct {
  126. Locked bool
  127. End string
  128. Attempts int
  129. }
  130. // broadcast subobject
  131. type LoginKeys struct {
  132. Old struct {
  133. Pub string
  134. Priv string
  135. }
  136. Cur struct {
  137. Pub string
  138. Priv string
  139. }
  140. }