mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
update formatTraffic so that bandwidth unit is always KB
This commit is contained in:
parent
ac8562803a
commit
3185487aea
1 changed files with 1 additions and 13 deletions
|
@ -84,16 +84,4 @@ func (b *bytesSyncLogger) ThroughputSummary() string {
|
|||
|
||||
func (b *bytesSyncLogger) GetStat() (in int, out int) { return b.inbound, b.outbound }
|
||||
|
||||
func formatTraffic(amount int) (value int, unit string) {
|
||||
value = amount
|
||||
units := []string{"B", "KB", "MB", "GB"}
|
||||
for i, u := range units {
|
||||
unit = u
|
||||
if (value < 1000) || (i == len(units)-1) {
|
||||
break
|
||||
}
|
||||
value = value / 1000
|
||||
}
|
||||
return
|
||||
|
||||
}
|
||||
func formatTraffic(amount int) (value int, unit string) { return amount / 1000, "KB" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue