Separate router discovery, evidence and authorized control from device runtime. Add Node/Core contracts and reusable operator surfaces.
26 lines
802 B
Go
26 lines
802 B
Go
package routers
|
|
|
|
import (
|
|
_ "embed"
|
|
"encoding/json"
|
|
)
|
|
|
|
// The factory profile is embedded in the versioned Node package. A clean host
|
|
// needs no manually installed monitor, cron, secret file or network override.
|
|
//
|
|
//go:embed profile.json
|
|
var profileJSON []byte
|
|
|
|
func profileValid() bool {
|
|
var p struct {
|
|
Schema string `json:"schema"`
|
|
Poll int `json:"poll_seconds"`
|
|
Devices int `json:"max_devices"`
|
|
Events int `json:"journal_events"`
|
|
Days int `json:"journal_days"`
|
|
Network bool `json:"network_changes"`
|
|
Router bool `json:"router_changes"`
|
|
}
|
|
return json.Unmarshal(profileJSON, &p) == nil && p.Schema == "missioncore.router-observation-profile/v1" && p.Poll == 10 && p.Devices == maxDevices && p.Events == maxEvents && p.Days == 7 && !p.Network && p.Router
|
|
}
|