56 lines
1.8 KiB
Go
56 lines
1.8 KiB
Go
package models
|
|
|
|
// Report is the top level JSON payload sent to the manager
|
|
type Report struct {
|
|
Version int `json:"version"`
|
|
Tick int64 `json:"tick"`
|
|
Type string `json:"type"` // "report", "relay", "register"
|
|
Nonce string `json:"nonce"`
|
|
Timestamp int64 `json:"timestamp"`
|
|
AgentID string `json:"agent_id"`
|
|
AgentVersion int `json:"agent_version"`
|
|
FleetID string `json:"fleet_id"`
|
|
HMAC string `json:"hmac"`
|
|
Data interface{} `json:"data"` // The actual payload logic
|
|
}
|
|
|
|
// SystemData is the core system status payload
|
|
type SystemData struct {
|
|
Hostname string `json:"hostname"`
|
|
UptimeSeconds int64 `json:"uptime_seconds"`
|
|
LoadAvg []float64 `json:"loadavg"`
|
|
Interfaces []Interface `json:"interfaces"`
|
|
Routes []Route `json:"routes"`
|
|
WGPeers []WGPeer `json:"wg_peers"`
|
|
}
|
|
|
|
type Interface struct {
|
|
Name string `json:"name"`
|
|
MAC string `json:"mac"`
|
|
Addresses []string `json:"addresses"`
|
|
IsVirtual bool `json:"is_virtual"`
|
|
VPNType *string `json:"vpn_type"` // "wireguard", "openvpn", etc.
|
|
}
|
|
|
|
type Route struct {
|
|
Dst string `json:"dst"`
|
|
Via string `json:"via"`
|
|
Dev string `json:"dev"`
|
|
}
|
|
|
|
type WGPeer struct {
|
|
Interface string `json:"interface"`
|
|
PublicKey string `json:"public_key"`
|
|
Endpoint string `json:"endpoint"`
|
|
AllowedIPs []string `json:"allowed_ips"`
|
|
LatestHandshake int64 `json:"latest_handshake"`
|
|
TransferRx int64 `json:"transfer_rx"`
|
|
TransferTx int64 `json:"transfer_tx"`
|
|
}
|
|
|
|
// RelayEnvelope is used when pushing a report over another peer
|
|
type RelayEnvelope struct {
|
|
RelayPath []string `json:"relay_path"` // array of agent_ids that routed this message
|
|
Payload Report `json:"payload"`
|
|
}
|