Skip to content

Commit

Permalink
[TASK] add support for wifictld
Browse files Browse the repository at this point in the history
  • Loading branch information
genofire committed Jun 18, 2018
1 parent cb6d388 commit c13645c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
21 changes: 11 additions & 10 deletions data/nodeinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions data/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
26 changes: 26 additions & 0 deletions data/wifictld.go
Original file line number Diff line number Diff line change
@@ -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 int32 `json:"client_try_threashold,omitempty"`
ClientSignalThreashold uint32 `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:"client25,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"`
}
11 changes: 11 additions & 0 deletions database/influxdb/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ func (conn *Connection) InsertNode(node *runtime.Node) {

conn.addPoint(MeasurementDHCP, tags, fields, time)
}

// 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
}

return
}

0 comments on commit c13645c

Please sign in to comment.