Skip to content

Commit

Permalink
fix: parse uppercase for ping-mode flag
Browse files Browse the repository at this point in the history
  • Loading branch information
r3inbowari committed Nov 11, 2023
1 parent d9cea13 commit f5933ae
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions speedtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"gopkg.in/alecthomas/kingpin.v2"
"os"
"strconv"
"strings"
"time"

"github.com/showwin/speedtest-go/speedtest"
Expand Down Expand Up @@ -151,8 +152,8 @@ func main() {
task.CheckError(server.DownloadTest())
}
ticker.Stop()
mean, _, std, min, max := speedtest.StandardDeviation(latencies)
task.Printf("Download: %.2fMbps (used: %.2fMB) (latency: %dms jitter: %dms min: %dms max: %dms)", server.DLSpeed, float64(server.Context.Manager.GetTotalDownload())/1024/1024, mean/1000000, std/1000000, min/1000000, max/1000000)
mean, _, std, minL, maxL := speedtest.StandardDeviation(latencies)
task.Printf("Download: %.2fMbps (used: %.2fMB) (latency: %dms jitter: %dms min: %dms max: %dms)", server.DLSpeed, float64(server.Context.Manager.GetTotalDownload())/1024/1024, mean/1000000, std/1000000, minL/1000000, maxL/1000000)
task.Complete()
})

Expand Down Expand Up @@ -187,8 +188,8 @@ func main() {
}
ticker.Stop()
quit = true
mean, _, std, min, max := speedtest.StandardDeviation(latencies)
task.Printf("Upload: %.2fMbps (used: %.2fMB) (latency: %dms jitter: %dms min: %dms max: %dms)", server.ULSpeed, float64(server.Context.Manager.GetTotalUpload())/1024/1024, mean/1000000, std/1000000, min/1000000, max/1000000)
mean, _, std, minL, maxL := speedtest.StandardDeviation(latencies)
task.Printf("Upload: %.2fMbps (used: %.2fMB) (latency: %dms jitter: %dms min: %dms max: %dms)", server.ULSpeed, float64(server.Context.Manager.GetTotalUpload())/1024/1024, mean/1000000, std/1000000, minL/1000000, maxL/1000000)
task.Complete()
})
taskManager.Reset()
Expand Down Expand Up @@ -220,6 +221,7 @@ func showServerList(servers speedtest.Servers) {
}

func parseProto(str string) speedtest.Proto {
str = strings.ToLower(str)
if str == "icmp" {
return speedtest.ICMP
} else if str == "tcp" {
Expand Down

0 comments on commit f5933ae

Please sign in to comment.