yanic/data/nodeinfo.go

96 lines
2.7 KiB
Go
Raw Permalink Normal View History

package data
// Nodeinfo struct
type Nodeinfo struct {
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"`
2016-06-29 00:04:33 +02:00
Wireless *Wireless `json:"wireless,omitempty"`
}
// 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"`
}
// Addresses returns a flat list of all MAC addresses
func (iface *NetworkInterface) Addresses() []string {
return append(append(iface.Interfaces.Other, iface.Interfaces.Tunnel...), iface.Interfaces.Wireless...)
}
// Network struct
type Network struct {
Mac string `json:"mac"`
Addresses []string `json:"addresses"`
Mesh map[string]*NetworkInterface `json:"mesh"`
// still used in gluon?
MeshInterfaces []string `json:"mesh_interfaces"`
}
// Owner struct
type Owner struct {
Contact string `json:"contact"`
}
// System struct
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"`
}
// Location struct
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"`
}
// Software struct
type Software struct {
2021-02-17 23:35:12 +01:00
Autoupdater *struct {
Enabled bool `json:"enabled,omitempty"`
Branch string `json:"branch,omitempty"`
} `json:"autoupdater,omitempty"`
2021-02-17 23:35:12 +01:00
BatmanAdv *struct {
Version string `json:"version,omitempty"`
Compat int `json:"compat,omitempty"`
} `json:"batman-adv,omitempty"`
2021-02-17 23:35:12 +01:00
Babeld *struct {
Version string `json:"version,omitempty"`
} `json:"babeld,omitempty"`
2021-02-17 23:35:12 +01:00
Fastd *struct {
Enabled bool `json:"enabled,omitempty"`
Version string `json:"version,omitempty"`
PublicKey string `json:"public_key,omitempty"`
} `json:"fastd,omitempty"`
2021-02-17 23:35:12 +01:00
Firmware *struct {
Base string `json:"base,omitempty"`
Release string `json:"release,omitempty"`
} `json:"firmware,omitempty"`
2021-02-17 23:35:12 +01:00
StatusPage *struct {
API int `json:"api"`
} `json:"status-page,omitempty"`
WireGuard *struct {
Enabled bool `json:"enabled,omitempty"`
PublicKey string `json:"public_key,omitempty"`
Version string `json:"version,omitempty"`
} `json:"wireguard,omitempty"`
}
// Hardware struct
type Hardware struct {
Nproc int `json:"nproc"`
Model string `json:"model,omitempty"`
}