mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 01:39:34 +08:00
33 lines
912 B
Go
33 lines
912 B
Go
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"`
|
|
}
|