mirror of
https://github.com/luscis/openlan.git
synced 2026-04-22 23:07:11 +08:00
fix: pretty bytes with Tb.
This commit is contained in:
@@ -210,7 +210,7 @@ func ListPhyLinks() []Device {
|
||||
State: state,
|
||||
Drop: attr.Statistics.RxDropped,
|
||||
Recv: attr.Statistics.RxBytes,
|
||||
Send: attr.Statistics.TxPackets,
|
||||
Send: attr.Statistics.TxBytes,
|
||||
Type: t,
|
||||
})
|
||||
}
|
||||
|
||||
+5
-1
@@ -248,7 +248,11 @@ func PrettyBytes(b uint64) string {
|
||||
return fmt.Sprintf("%d.%02dMb", m, d)
|
||||
}
|
||||
g, d := split(m, 1024)
|
||||
return fmt.Sprintf("%d.%02dGb", g, d)
|
||||
if g < 1024 {
|
||||
return fmt.Sprintf("%d.%02dGb", g, d)
|
||||
}
|
||||
t, d := split(g, 1024)
|
||||
return fmt.Sprintf("%d.%02dTb", t, d)
|
||||
}
|
||||
|
||||
func GetIPAddr(addr string) string {
|
||||
|
||||
Reference in New Issue
Block a user