mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 17:59:28 +08:00
rename /src to /internal (sorry i'll fix the prs)
This commit is contained in:
32
internal/common/common-ws.go
Normal file
32
internal/common/common-ws.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package common
|
||||
|
||||
type WebSocketAction = uint8
|
||||
|
||||
// Not implemented yet
|
||||
// type AgentError = uint8
|
||||
|
||||
const (
|
||||
// Request system data from agent
|
||||
GetData WebSocketAction = iota
|
||||
// Check the fingerprint of the agent
|
||||
CheckFingerprint
|
||||
)
|
||||
|
||||
// HubRequest defines the structure for requests sent from hub to agent.
|
||||
type HubRequest[T any] struct {
|
||||
Action WebSocketAction `cbor:"0,keyasint"`
|
||||
Data T `cbor:"1,keyasint,omitempty,omitzero"`
|
||||
// Error AgentError `cbor:"error,omitempty,omitzero"`
|
||||
}
|
||||
|
||||
type FingerprintRequest struct {
|
||||
Signature []byte `cbor:"0,keyasint"`
|
||||
NeedSysInfo bool `cbor:"1,keyasint"` // For universal token system creation
|
||||
}
|
||||
|
||||
type FingerprintResponse struct {
|
||||
Fingerprint string `cbor:"0,keyasint"`
|
||||
// Optional system info for universal token system creation
|
||||
Hostname string `cbor:"1,keyasint,omitempty,omitzero"`
|
||||
Port string `cbor:"2,keyasint,omitempty,omitzero"`
|
||||
}
|
Reference in New Issue
Block a user