2020-12-29 17:52:15 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
type device struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
MAC string `json:"mac"`
|
|
|
|
GatewayNexthop string `json:"gateway_nexthop"`
|
|
|
|
Gateway string `json:"gateway"`
|
|
|
|
Domain string `json:"domain"`
|
|
|
|
Location struct {
|
|
|
|
Longitude float64 `json:"longitude"`
|
|
|
|
Latitude float64 `json:"latitude"`
|
|
|
|
} `json:"location"`
|
|
|
|
}
|
|
|
|
type devices struct {
|
|
|
|
Devices []device `json:"devices"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type unifiAPIResponse struct {
|
|
|
|
Identification struct {
|
|
|
|
ID string `json:"id"`
|
|
|
|
MAC string `json:"mac"`
|
|
|
|
Started time.Time `json:"started"`
|
|
|
|
} `json:"identification"`
|
|
|
|
Overview struct {
|
|
|
|
LastSeen time.Time `json:"lastSeen"`
|
|
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
|
|
Status string `json:"status"`
|
|
|
|
} `json:"overview"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type unifiAPIDetails struct {
|
|
|
|
Identification struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Model string `json:"model"`
|
|
|
|
} `json:"identification"`
|
|
|
|
Firmware struct {
|
|
|
|
Current string `json:"current"`
|
|
|
|
} `json:"firmware"`
|
|
|
|
Overview struct {
|
|
|
|
CPU float64 `json:"cpu"`
|
|
|
|
RAM float64 `json:"ram"`
|
|
|
|
} `json:"overview"`
|
|
|
|
IPAddress string `json:"ipAddress"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type unifiAPIAirmax struct {
|
|
|
|
DeviceIdentification struct {
|
|
|
|
MAC string `json:"mac"`
|
|
|
|
} `json:"deviceidentification"`
|
|
|
|
Statistics struct {
|
|
|
|
LinkScore float64 `json:"linkScore"`
|
|
|
|
} `json:"statistics"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type link struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Source string `json:"source"`
|
|
|
|
Target string `json:"target"`
|
|
|
|
SourceTQ float64 `json:"source_tq"`
|
|
|
|
TargetTQ float64 `json:"target_tq"`
|
|
|
|
SourceAddr string `json:"source_addr"`
|
|
|
|
TargetAddr string `json:"target_addr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type node struct {
|
|
|
|
Firstseen string `json:"firstseen"`
|
|
|
|
Lastseen string `json:"lastseen"`
|
|
|
|
IsOnline bool `json:"is_online"`
|
|
|
|
IsGateway bool `json:"is_gateway"`
|
|
|
|
Clients int `json:"clients"`
|
|
|
|
ClientsWifi24 int `json:"clients_wifi24"`
|
|
|
|
ClientsWifi5 int `json:"clients_wifi5"`
|
|
|
|
ClientsOther int `json:"clients_other"`
|
|
|
|
RootFSUsage int `json:"rootfs_usage"`
|
|
|
|
LoadAVG float64 `json:"loadavg"`
|
|
|
|
MemoryUsage float64 `json:"memory_usage"`
|
|
|
|
Uptime string `json:"uptime"`
|
|
|
|
GatewayNexthop string `json:"gateway_nexthop"`
|
|
|
|
Gateway string `json:"gateway"`
|
|
|
|
Location struct {
|
|
|
|
Longitude float64 `json:"longitude"`
|
|
|
|
Latitude float64 `json:"latitude"`
|
|
|
|
} `json:"location"`
|
|
|
|
NodeID string `json:"node_id"`
|
|
|
|
MAC string `json:"mac"`
|
|
|
|
Adresses []string `json:"addresses"`
|
|
|
|
Domain string `json:"domain"`
|
|
|
|
Hostname string `json:"hostname"`
|
|
|
|
Owner string `json:"owner"`
|
|
|
|
Firmware firmware `json:"firmware"`
|
|
|
|
Autoupdater autoupdater `json:"autoupdater"`
|
|
|
|
NProc int `json:"nproc"`
|
|
|
|
Model string `json:"model"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type firmware struct {
|
|
|
|
Base string `json:"base"`
|
|
|
|
Release string `json:"release"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type autoupdater struct {
|
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
Branch string `json:"branch"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type output struct {
|
|
|
|
Timestamp string `json:"timestamp"`
|
|
|
|
Nodes []node `json:"nodes"`
|
|
|
|
Links []link `json:"links"`
|
|
|
|
}
|
2020-12-31 11:20:58 +00:00
|
|
|
|
|
|
|
type apiResponse struct {
|
|
|
|
StatusCode int `json:"statusCode"`
|
|
|
|
Error string `json:"error"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
}
|