* lib/model: Remove bogus fields from connections API endpoint. Switch the returned data type for the /rest/system/connections element "total" to use only the Statistics struct. The other fields of the ConnectionInfo struct are not populated and misleading. * Lowercase JSON field names. * lib/model: Get rid of ConnectionInfo.MarshalJSON(). It was missing the StartedAt field from the embedded Statistics struct. Just lowercasing the JSON attribute names can be done just as easily with annotations. * lib/model: Remove bogus startedAt field from totals. Instead of using the Statistics type with one field empty, just switch to a free-form map with the three needed fields.
This commit is contained in:
@@ -994,10 +994,10 @@ func (c *rawConnection) pingReceiver() {
|
||||
}
|
||||
|
||||
type Statistics struct {
|
||||
At time.Time
|
||||
InBytesTotal int64
|
||||
OutBytesTotal int64
|
||||
StartedAt time.Time
|
||||
At time.Time `json:"at"`
|
||||
InBytesTotal int64 `json:"inBytesTotal"`
|
||||
OutBytesTotal int64 `json:"outBytesTotal"`
|
||||
StartedAt time.Time `json:"startedAt"`
|
||||
}
|
||||
|
||||
func (c *rawConnection) Statistics() Statistics {
|
||||
|
||||
Reference in New Issue
Block a user