mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: moved from JSON objects of metrics to simplified strings for the Stats Remote
This commit is contained in:
@@ -68,7 +68,7 @@ public struct Bandwidth: Codable {
|
||||
var download: Int64 = 0
|
||||
}
|
||||
|
||||
public struct Network_Usage: Codable {
|
||||
public struct Network_Usage: Codable, RemoteType {
|
||||
var bandwidth: Bandwidth = Bandwidth()
|
||||
var total: Bandwidth = Bandwidth()
|
||||
|
||||
@@ -92,6 +92,12 @@ public struct Network_Usage: Codable {
|
||||
|
||||
self.wifiDetails.reset()
|
||||
}
|
||||
|
||||
public func remote() -> Data? {
|
||||
let addr = "\(self.laddr.v4 ?? ""),\(self.laddr.v6 ?? ""),\(self.raddr.v4 ?? ""),\(self.raddr.v6 ?? "")"
|
||||
let string = "1,\(self.interface?.BSDName ?? ""),1,\(self.bandwidth.download),\(self.bandwidth.upload),\(addr)$"
|
||||
return string.data(using: .utf8)
|
||||
}
|
||||
}
|
||||
|
||||
public struct Network_Connectivity: Codable {
|
||||
|
||||
Reference in New Issue
Block a user