From 3185487aea4efcdfd70812222b1bd005e270242b Mon Sep 17 00:00:00 2001 From: luciole Date: Thu, 10 Nov 2022 15:12:46 +0100 Subject: [PATCH] update formatTraffic so that bandwidth unit is always KB --- proxy/lib/util.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/proxy/lib/util.go b/proxy/lib/util.go index c7b3684..c444bb0 100644 --- a/proxy/lib/util.go +++ b/proxy/lib/util.go @@ -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" }