2016-03-12 12:32:55 +00:00
|
|
|
package data
|
|
|
|
|
2019-01-24 01:56:13 +00:00
|
|
|
// Nodeinfo struct
|
|
|
|
type Nodeinfo struct {
|
2017-01-20 21:27:44 +00:00
|
|
|
NodeID string `json:"node_id"`
|
2016-03-12 12:32:55 +00:00
|
|
|
Network Network `json:"network"`
|
2017-05-20 12:46:29 +00:00
|
|
|
Owner *Owner `json:"owner"`
|
2016-03-12 12:32:55 +00: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-28 22:04:33 +00:00
|
|
|
Wireless *Wireless `json:"wireless,omitempty"`
|
2016-03-12 12:32:55 +00:00
|
|
|
}
|
2017-01-20 21:27:44 +00:00
|
|
|
|
2017-12-05 22:17:49 +00:00
|
|
|
// NetworkInterface struct
|
|
|
|
type NetworkInterface struct {
|
2016-04-29 06:25:45 +00:00
|
|
|
Interfaces struct {
|
|
|
|
Wireless []string `json:"wireless,omitempty"`
|
|
|
|
Other []string `json:"other,omitempty"`
|
|
|
|
Tunnel []string `json:"tunnel,omitempty"`
|
|
|
|
} `json:"interfaces"`
|
|
|
|
}
|
2016-03-12 12:32:55 +00:00
|
|
|
|
2017-09-27 11:55:02 +00:00
|
|
|
// Addresses returns a flat list of all MAC addresses
|
2017-12-05 22:17:49 +00:00
|
|
|
func (iface *NetworkInterface) Addresses() []string {
|
2017-09-27 11:55:02 +00:00
|
|
|
return append(append(iface.Interfaces.Other, iface.Interfaces.Tunnel...), iface.Interfaces.Wireless...)
|
|
|
|
}
|
|
|
|
|
2017-01-20 21:27:44 +00:00
|
|
|
// Network struct
|
2016-03-12 12:32:55 +00:00
|
|
|
type Network struct {
|
2017-12-05 22:17:49 +00: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 12:32:55 +00:00
|
|
|
}
|
|
|
|
|
2017-01-20 21:27:44 +00:00
|
|
|
// Owner struct
|
2016-03-12 12:32:55 +00:00
|
|
|
type Owner struct {
|
|
|
|
Contact string `json:"contact"`
|
|
|
|
}
|
|
|
|
|
2017-01-20 21:27:44 +00:00
|
|
|
// System struct
|
2016-03-12 12:32:55 +00:00
|
|
|
type System struct {
|
2018-01-17 19:20:35 +00:00
|
|
|
SiteCode string `json:"site_code,omitempty"`
|
|
|
|
DomainCode string `json:"domain_code,omitempty"`
|
2016-03-12 12:32:55 +00:00
|
|
|
}
|
|
|
|
|
2017-01-20 21:27:44 +00:00
|
|
|
// Location struct
|
2016-03-12 12:32:55 +00:00
|
|
|
type Location struct {
|
2017-11-23 12:01:39 +00:00
|
|
|
Longitude float64 `json:"longitude,omitempty"`
|
|
|
|
Latitude float64 `json:"latitude,omitempty"`
|
|
|
|
Altitude float64 `json:"altitude,omitempty"`
|
2016-03-12 12:32:55 +00:00
|
|
|
}
|
|
|
|
|
2017-01-20 21:27:44 +00:00
|
|
|
// Software struct
|
2016-03-12 12:32:55 +00:00
|
|
|
type Software struct {
|
2016-12-15 09:43:07 +00:00
|
|
|
Autoupdater struct {
|
|
|
|
Enabled bool `json:"enabled,omitempty"`
|
|
|
|
Branch string `json:"branch,omitempty"`
|
2016-03-12 12:32:55 +00:00
|
|
|
} `json:"autoupdater,omitempty"`
|
2016-12-15 09:43:07 +00:00
|
|
|
BatmanAdv struct {
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
Compat int `json:"compat,omitempty"`
|
2016-03-12 12:32:55 +00:00
|
|
|
} `json:"batman-adv,omitempty"`
|
2017-12-05 22:17:49 +00:00
|
|
|
Babeld struct {
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
} `json:"babeld,omitempty"`
|
2016-12-15 09:43:07 +00:00
|
|
|
Fastd struct {
|
2018-07-10 15:49:27 +00:00
|
|
|
Enabled bool `json:"enabled,omitempty"`
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
PublicKey string `json:"public_key,omitempty"`
|
2016-03-12 12:32:55 +00:00
|
|
|
} `json:"fastd,omitempty"`
|
2016-12-15 09:43:07 +00:00
|
|
|
Firmware struct {
|
|
|
|
Base string `json:"base,omitempty"`
|
|
|
|
Release string `json:"release,omitempty"`
|
2016-03-12 12:32:55 +00:00
|
|
|
} `json:"firmware,omitempty"`
|
2016-12-15 09:43:07 +00:00
|
|
|
StatusPage struct {
|
2017-01-20 21:27:44 +00:00
|
|
|
API int `json:"api"`
|
2016-03-12 12:32:55 +00:00
|
|
|
} `json:"status-page,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-01-20 21:27:44 +00:00
|
|
|
// Hardware struct
|
2016-03-12 12:32:55 +00:00
|
|
|
type Hardware struct {
|
|
|
|
Nproc int `json:"nproc"`
|
2017-02-07 10:33:55 +00:00
|
|
|
Model string `json:"model,omitempty"`
|
2016-03-12 12:32:55 +00:00
|
|
|
}
|