2016-03-12 13:32:55 +01:00
|
|
|
package data
|
|
|
|
|
2019-01-24 02:56:13 +01:00
|
|
|
// Nodeinfo struct
|
|
|
|
type Nodeinfo struct {
|
2018-06-18 15:21:07 +02:00
|
|
|
NodeID string `json:"node_id"`
|
|
|
|
Network Network `json:"network"`
|
|
|
|
Owner *Owner `json:"owner"`
|
|
|
|
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"`
|
|
|
|
Wireless *Wireless `json:"wireless,omitempty"`
|
|
|
|
Wifictld *WifiCTLDNodeinfo `json:"wifictld,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 {
|
2018-01-17 20:20:35 +01:00
|
|
|
SiteCode string `json:"site_code,omitempty"`
|
|
|
|
DomainCode string `json:"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 {
|
2016-12-15 10:43:07 +01:00
|
|
|
Autoupdater struct {
|
|
|
|
Enabled bool `json:"enabled,omitempty"`
|
|
|
|
Branch string `json:"branch,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
} `json:"autoupdater,omitempty"`
|
2016-12-15 10:43:07 +01:00
|
|
|
BatmanAdv struct {
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
Compat int `json:"compat,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
} `json:"batman-adv,omitempty"`
|
2017-12-05 23:17:49 +01:00
|
|
|
Babeld struct {
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
} `json:"babeld,omitempty"`
|
2016-12-15 10:43:07 +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"`
|
2016-12-15 10:43:07 +01:00
|
|
|
Firmware struct {
|
|
|
|
Base string `json:"base,omitempty"`
|
|
|
|
Release string `json:"release,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
} `json:"firmware,omitempty"`
|
2016-12-15 10:43:07 +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"`
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|