[TASK] add support for wifictld

This commit is contained in:
Martin/Geno 2018-06-18 15:21:07 +02:00
parent 4031d82047
commit 438425c872
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
4 changed files with 49 additions and 10 deletions

View File

@ -2,16 +2,17 @@ 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"`
Wireless *Wireless `json:"wireless,omitempty"`
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"`
}
// NetworkInterface struct

View File

@ -32,6 +32,7 @@ type Statistics struct {
} `json:"traffic,omitempty"`
Switch map[string]*SwitchPort `json:"switch,omitempty"`
Wireless WirelessStatistics `json:"wireless,omitempty"`
Wifictld *WifiCTLDStatistics `json:"wifictld,omitempty"`
ProcStats *ProcStats `json:"stat,omitempty"`
}

26
data/wifictld.go Normal file
View File

@ -0,0 +1,26 @@
package data
// WifiCTLDNodeinfo struct (defined in: https://chaos.expert/genofire/wifictld/blob/preview/wireless/wifictld/src/ubus_service.c - ubus_get_config)
type WifiCTLDNodeinfo struct {
Verbose uint8 `json:"verbose,omitempty"`
ClientTryThreashold uint32 `json:"client_try_threashold,omitempty"`
ClientSignalThreashold int32 `json:"client_signal_threashold,omitempty"`
ClientCleanEvery uint32 `json:"client_clean_every,omitempty"`
ClientCleanOlderThen uint32 `json:"client_clean_older_then,omitempty"`
ClientCleanAuthed uint8 `json:"client_clean_authed,omitempty"`
ClientForce uint8 `json:"client_force,omitempty"`
ClientForceProbe uint8 `json:"client_force_probe,omitempty"`
ClientProbeSteering uint8 `json:"client_probe_steering,omitempty"`
ClientProbeLearning uint8 `json:"client_probe_learning,omitempty"`
}
// WifiCTLDStatistics struct (defined in: https://chaos.expert/genofire/wifictld/blob/preview/wireless/respondd-module-wifictld/src/respondd.c - respondd_provider_statistics)
type WifiCTLDStatistics struct {
Total uint32 `json:"total,omitempty"`
Client24 uint32 `json:"client24,omitempty"`
Client5 uint32 `json:"client5,omitempty"`
Authed uint32 `json:"authed,omitempty"`
Connected uint32 `json:"connected,omitempty"`
HighestTryProbe uint32 `json:"highest_try_probe,omitempty"`
HighestTryAuth uint32 `json:"highest_try_auth,omitempty"`
}

View File

@ -153,6 +153,17 @@ func (conn *Connection) InsertNode(node *runtime.Node) {
tags.SetString("frequency"+suffix, strconv.Itoa(int(airtime.Frequency)))
}
// Add Wifictld statistics
if wifictld := stats.Wifictld; wifictld != nil {
fields["wifictld.total"] = wifictld.Total
fields["wifictld.client24"] = wifictld.Client24
fields["wifictld.client5"] = wifictld.Client5
fields["wifictld.authed"] = wifictld.Authed
fields["wifictld.connected"] = wifictld.Connected
fields["wifictld.highest_try_probe"] = wifictld.HighestTryProbe
fields["wifictld.highest_try_auth"] = wifictld.HighestTryAuth
}
conn.addPoint(MeasurementNode, tags, fields, time)
// Add DHCP statistics