2023-05-11 19:38:10 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func processGateways() []node {
|
|
|
|
d := getDevices(conf.Gateways.GatewaysURL)
|
|
|
|
var nodes []node
|
|
|
|
for i := range d.Devices {
|
|
|
|
log.Println("Processing Static Device: ", d.Devices[i].Name)
|
|
|
|
nodes = append(nodes, node{
|
|
|
|
Firstseen: time.Now().Format(iso8601),
|
|
|
|
Lastseen: time.Now().Format(iso8601),
|
|
|
|
IsOnline: true,
|
|
|
|
IsGateway: true,
|
|
|
|
Clients: 0,
|
|
|
|
ClientsWifi24: 0,
|
|
|
|
ClientsWifi5: 0,
|
|
|
|
ClientsOther: 0,
|
|
|
|
RootFSUsage: 0,
|
|
|
|
LoadAVG: 0,
|
|
|
|
MemoryUsage: 0,
|
|
|
|
Uptime: time.Now().Format(iso8601),
|
2023-05-12 05:55:58 +00:00
|
|
|
GatewayNexthop: "",
|
|
|
|
Gateway: "",
|
2023-05-11 19:38:10 +00:00
|
|
|
NodeID: strings.ReplaceAll(d.Devices[i].MAC, ":", ""),
|
|
|
|
MAC: d.Devices[i].MAC,
|
2023-05-12 06:17:31 +00:00
|
|
|
Adresses: d.Devices[i].Adresses,
|
2023-05-11 19:38:10 +00:00
|
|
|
Domain: d.Devices[i].Domain,
|
|
|
|
Hostname: "[Gateway] " + d.Devices[i].Name,
|
|
|
|
Owner: "Freifunk Troisdorf",
|
|
|
|
Firmware: firmware{
|
|
|
|
Base: "KVM",
|
|
|
|
Release: "Ubuntu 22.04",
|
|
|
|
},
|
|
|
|
Autoupdater: autoupdater{
|
|
|
|
Enabled: false,
|
|
|
|
Branch: "stable",
|
|
|
|
},
|
|
|
|
NProc: 1,
|
|
|
|
Model: "KVM",
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return nodes
|
|
|
|
}
|