2016-03-12 13:32:55 +01:00
|
|
|
package data
|
|
|
|
|
2019-01-24 02:56:13 +01:00
|
|
|
// Nodeinfo struct
|
|
|
|
type Nodeinfo struct {
|
2017-01-20 22:27:44 +01:00
|
|
|
NodeID string `json:"node_id"`
|
2016-03-12 13:32:55 +01:00
|
|
|
Network Network `json:"network"`
|
2017-05-20 14:46:29 +02:00
|
|
|
Owner *Owner `json:"owner"`
|
2016-03-12 13:32:55 +01:00
|
|
|
System System `json:"system"`
|
|
|
|
Hostname string `json:"hostname"`
|
|
|
|
Location *Location `json:"location,omitempty"`
|
|
|
|
Software Software `json:"software"`
|
|
|
|
Hardware Hardware `json:"hardware"`
|
|
|
|
VPN bool `json:"vpn"`
|
2016-06-29 00:04:33 +02:00
|
|
|
Wireless *Wireless `json:"wireless,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
}
|
2017-01-20 22:27:44 +01:00
|
|
|
|
2017-12-05 23:17:49 +01:00
|
|
|
// NetworkInterface struct
|
|
|
|
type NetworkInterface struct {
|
2016-04-29 08:25:45 +02:00
|
|
|
Interfaces struct {
|
|
|
|
Wireless []string `json:"wireless,omitempty"`
|
|
|
|
Other []string `json:"other,omitempty"`
|
|
|
|
Tunnel []string `json:"tunnel,omitempty"`
|
|
|
|
} `json:"interfaces"`
|
|
|
|
}
|
2016-03-12 13:32:55 +01:00
|
|
|
|
2017-09-27 13:55:02 +02:00
|
|
|
// Addresses returns a flat list of all MAC addresses
|
2017-12-05 23:17:49 +01:00
|
|
|
func (iface *NetworkInterface) Addresses() []string {
|
2017-09-27 13:55:02 +02:00
|
|
|
return append(append(iface.Interfaces.Other, iface.Interfaces.Tunnel...), iface.Interfaces.Wireless...)
|
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// Network struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type Network struct {
|
2017-12-05 23:17:49 +01:00
|
|
|
Mac string `json:"mac"`
|
|
|
|
Addresses []string `json:"addresses"`
|
|
|
|
Mesh map[string]*NetworkInterface `json:"mesh"`
|
|
|
|
// still used in gluon?
|
|
|
|
MeshInterfaces []string `json:"mesh_interfaces"`
|
2016-03-12 13:32:55 +01:00
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// Owner struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type Owner struct {
|
|
|
|
Contact string `json:"contact"`
|
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// System struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type System struct {
|
2022-04-14 00:38:00 +02:00
|
|
|
SiteCode string `json:"site_code,omitempty"`
|
|
|
|
DomainCode string `json:"domain_code,omitempty"`
|
|
|
|
PrimaryDomainCode string `json:"primary_domain_code,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// Location struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type Location struct {
|
2017-11-23 13:01:39 +01:00
|
|
|
Longitude float64 `json:"longitude,omitempty"`
|
|
|
|
Latitude float64 `json:"latitude,omitempty"`
|
|
|
|
Altitude float64 `json:"altitude,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// Software struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type Software struct {
|
2021-02-17 23:35:12 +01:00
|
|
|
Autoupdater *struct {
|
2016-12-15 10:43:07 +01:00
|
|
|
Enabled bool `json:"enabled,omitempty"`
|
|
|
|
Branch string `json:"branch,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
} `json:"autoupdater,omitempty"`
|
2021-02-17 23:35:12 +01:00
|
|
|
BatmanAdv *struct {
|
2016-12-15 10:43:07 +01:00
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
Compat int `json:"compat,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
} `json:"batman-adv,omitempty"`
|
2021-02-17 23:35:12 +01:00
|
|
|
Babeld *struct {
|
2017-12-05 23:17:49 +01:00
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
} `json:"babeld,omitempty"`
|
2021-02-17 23:35:12 +01:00
|
|
|
Fastd *struct {
|
2018-07-10 17:49:27 +02:00
|
|
|
Enabled bool `json:"enabled,omitempty"`
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
PublicKey string `json:"public_key,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
} `json:"fastd,omitempty"`
|
2021-02-17 23:35:12 +01:00
|
|
|
Firmware *struct {
|
2016-12-15 10:43:07 +01:00
|
|
|
Base string `json:"base,omitempty"`
|
|
|
|
Release string `json:"release,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
} `json:"firmware,omitempty"`
|
2021-02-17 23:35:12 +01:00
|
|
|
StatusPage *struct {
|
2017-01-20 22:27:44 +01:00
|
|
|
API int `json:"api"`
|
2016-03-12 13:32:55 +01:00
|
|
|
} `json:"status-page,omitempty"`
|
2021-02-15 15:04:11 +01:00
|
|
|
WireGuard *struct {
|
|
|
|
Enabled bool `json:"enabled,omitempty"`
|
|
|
|
PublicKey string `json:"public_key,omitempty"`
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
} `json:"wireguard,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// Hardware struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type Hardware struct {
|
|
|
|
Nproc int `json:"nproc"`
|
2017-02-07 11:33:55 +01:00
|
|
|
Model string `json:"model,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
}
|