mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 06:16:37 +08:00
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
package protocol
|
|
|
|
type APIResponse[T any] struct {
|
|
Success bool `json:"success"`
|
|
Message string `json:"message"`
|
|
Data T `json:"data"`
|
|
}
|
|
|
|
type HeartbeatAPIResponse struct {
|
|
Success bool `json:"success"`
|
|
Message string `json:"message"`
|
|
Data any `json:"data"`
|
|
AgentSettings *AgentSettings `json:"agent_settings,omitempty"`
|
|
}
|
|
|
|
type AgentSettings struct {
|
|
HeartbeatInterval int `json:"heartbeat_interval"`
|
|
SyncInterval int `json:"sync_interval"`
|
|
AutoUpdate bool `json:"auto_update"`
|
|
UpdateRepo string `json:"update_repo"`
|
|
UpdateNow bool `json:"update_now"`
|
|
}
|
|
|
|
type NodePayload struct {
|
|
NodeID string `json:"node_id"`
|
|
Name string `json:"name"`
|
|
IP string `json:"ip"`
|
|
AgentVersion string `json:"agent_version"`
|
|
NginxVersion string `json:"nginx_version"`
|
|
CurrentVersion string `json:"current_version"`
|
|
LastError string `json:"last_error"`
|
|
}
|
|
|
|
type RegisterNodeResponse struct {
|
|
NodeID string `json:"node_id"`
|
|
AgentToken string `json:"agent_token"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type ApplyLogPayload struct {
|
|
NodeID string `json:"node_id"`
|
|
Version string `json:"version"`
|
|
Result string `json:"result"`
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
type ActiveConfigResponse struct {
|
|
Version string `json:"version"`
|
|
Checksum string `json:"checksum"`
|
|
RenderedConfig string `json:"rendered_config"`
|
|
SupportFiles []SupportFile `json:"support_files"`
|
|
CreatedAt string `json:"created_at"`
|
|
}
|
|
|
|
type SupportFile struct {
|
|
Path string `json:"path"`
|
|
Content string `json:"content"`
|
|
}
|