add timestamp to report

This commit is contained in:
Callan Bryant 2020-05-30 14:40:07 +01:00
parent 9214a5c020
commit 039cd4eb8b
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA

View File

@ -31,6 +31,8 @@ type DsnetReport struct {
TransmitBytes uint64 TransmitBytes uint64
ReceiveBytesSI string ReceiveBytesSI string
TransmitBytesSI string TransmitBytesSI string
// when the report was made
Timestamp time.Time
} }
func GenerateReport(dev *wgtypes.Device, conf *DsnetConfig, oldReport *DsnetReport) DsnetReport { func GenerateReport(dev *wgtypes.Device, conf *DsnetConfig, oldReport *DsnetReport) DsnetReport {
@ -111,6 +113,7 @@ func GenerateReport(dev *wgtypes.Device, conf *DsnetConfig, oldReport *DsnetRepo
TransmitBytes: stats.TxBytes, TransmitBytes: stats.TxBytes,
ReceiveBytesSI: BytesToSI(stats.RxBytes), ReceiveBytesSI: BytesToSI(stats.RxBytes),
TransmitBytesSI: BytesToSI(stats.TxBytes), TransmitBytesSI: BytesToSI(stats.TxBytes),
Timestamp: time.Now(),
} }
} }