package clusters import "github.com/iwind/TeaGo/maps" func mockClusters() []maps.Map { return []maps.Map{ { "id": int64(1), "name": "gateway-cn-hz", "region": "cn-hangzhou", "gatewayDomain": "gw-hz.httpdns.example.com", "installDir": "/opt/edge-httpdns", "countAllNodes": 3, "countActiveNodes": 3, "countApps": 5, "cacheTtl": 30, "fallbackTimeout": 300, "isOn": true, }, { "id": int64(2), "name": "gateway-cn-bj", "region": "cn-beijing", "gatewayDomain": "gw-bj.httpdns.example.com", "installDir": "/opt/edge-httpdns", "countAllNodes": 3, "countActiveNodes": 2, "countApps": 2, "cacheTtl": 30, "fallbackTimeout": 300, "isOn": true, }, } } func pickCluster(clusterId int64) maps.Map { clusters := mockClusters() if clusterId <= 0 { return clusters[0] } for _, c := range clusters { if c.GetInt64("id") == clusterId { return c } } return clusters[0] } func mockNodes(clusterId int64, installState int, activeState int, keyword string) []maps.Map { _ = clusterId return []maps.Map{ { "id": int64(101), "name": "45.250.184.56", "isInstalled": true, "isOn": true, "isUp": true, "installStatus": maps.Map{ "isRunning": false, "isFinished": true, "isOk": true, "error": "", }, "status": maps.Map{ "isActive": true, "updatedAt": 1700000000, "hostname": "node-01", "cpuUsage": 0.0253, "cpuUsageText": "2.53%", "memUsage": 0.5972, "memUsageText": "59.72%", "load1m": 0.02, }, "ipAddresses": []maps.Map{ { "id": 1, "name": "", "ip": "45.250.184.56", "canAccess": true, }, }, }, { "id": int64(102), "name": "45.250.184.53", "isInstalled": true, "isOn": true, "isUp": true, "installStatus": maps.Map{ "isRunning": false, "isFinished": true, "isOk": true, "error": "", }, "status": maps.Map{ "isActive": true, "updatedAt": 1700000000, "hostname": "node-02", "cpuUsage": 0.0039, "cpuUsageText": "0.39%", "memUsage": 0.0355, "memUsageText": "3.55%", "load1m": 0.0, }, "ipAddresses": []maps.Map{ { "id": 2, "name": "", "ip": "45.250.184.53", "canAccess": true, }, }, }, } } func mockCerts() []maps.Map { return []maps.Map{ { "id": int64(11), "domain": "resolve.edge.example.com", "issuer": "Mock CA", "expiresAt": "2026-12-31 23:59:59", }, } }