Repository navigation
Expand file tree
/
Copy pathtypes.go
More file actions
48 lines (41 loc) · 1.5 KB
/
Copy pathtypes.go
File metadata and controls
48 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"github.com/wailsapp/wails/v3/pkg/application"
"changeme/internal/core"
"changeme/internal/storage"
)
// PingEvent represents a latency update event emitted to the frontend.
type PingEvent struct {
ID string `json:"id"`
Ping int64 `json:"ping"`
}
// VpnStatusEvent represents an active connection status update event.
type VpnStatusEvent struct {
Connected bool `json:"connected"`
ActiveProfileID string `json:"activeProfileId"`
ActiveMode string `json:"activeMode"`
}
// AppState represents the comprehensive state of the desktop client.
type AppState struct {
Connected bool `json:"connected"`
ActiveProfileID string `json:"activeProfileId"`
ActiveMode string `json:"activeMode"`
CoreVersion string `json:"coreVersion"`
Settings storage.Settings `json:"settings"`
Stats core.TrafficStats `json:"stats"`
}
// UpdateInfo represents release details returned when checking for updates.
type UpdateInfo struct {
Available bool `json:"available"`
Version string `json:"version"`
Name string `json:"name"`
Notes string `json:"notes"`
PublishedAt string `json:"publishedAt"`
CurrentVersion string `json:"currentVersion"`
}
func init() {
application.RegisterEvent[core.TrafficStats]("traffic:update")
application.RegisterEvent[string]("log:new")
application.RegisterEvent[PingEvent]("profile:ping")
application.RegisterEvent[VpnStatusEvent]("vpn:status")
}