summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile24
-rw-r--r--networkQuality.go16
2 files changed, 34 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..e96afa8
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,24 @@
+# Dockerfile to clone the goresponsiveness repository
+# build the binary
+# make it ready to run
+
+# Build with: docker build -t goresp .
+
+# Run with: docker run goresp
+
+FROM golang:1.17.8-alpine3.15
+
+RUN mkdir /goresponsiveness
+ADD . /goresponsiveness
+WORKDIR /goresponsiveness
+
+RUN go mod download
+RUN go build -o networkQuality networkQuality.go
+
+# `docker run` invokes the networkQuality binary that was just built
+ENTRYPOINT ["/goresponsiveness/networkQuality"]
+
+# These default parameters test against Apple's public servers
+# If you change any of these on the `docker run` command, you need to provide them all
+CMD ["-config","mensura.cdn-apple.com","-port","443","-path","/api/v1/gm/config"]
+
diff --git a/networkQuality.go b/networkQuality.go
index 7e4d294..09ec953 100644
--- a/networkQuality.go
+++ b/networkQuality.go
@@ -418,6 +418,10 @@ func main() {
fmt.Printf("Test will end earlier than %v\n", timeoutAbsoluteTime)
}
+ // print the banner
+ dt := time.Now().UTC()
+ fmt.Printf("%s UTC Go Responsiveness to %s...\n", dt.Format("01-02-2006 15:04:05"),configHostPort)
+
if len(*profile) != 0 {
f, err := os.Create(*profile)
if err != nil {
@@ -612,24 +616,24 @@ func main() {
}
}
}
-
+
fmt.Printf(
- "Download: %f MBps (%f Mbps), using %d parallel connections.\n",
- utilities.ToMBps(downloadSaturation.RateBps),
+ "Download: %7.3f Mbps (%7.3f MBps), using %d parallel connections.\n",
utilities.ToMbps(downloadSaturation.RateBps),
+ utilities.ToMBps(downloadSaturation.RateBps),
len(downloadSaturation.Lbcs),
)
fmt.Printf(
- "Upload: %f MBps (%f Mbps), using %d parallel connections.\n",
- utilities.ToMBps(uploadSaturation.RateBps),
+ "Upload: %7.3f Mbps (%7.3f MBps), using %d parallel connections.\n",
utilities.ToMbps(uploadSaturation.RateBps),
+ utilities.ToMBps(uploadSaturation.RateBps),
len(uploadSaturation.Lbcs),
)
if totalRTTsCount != 0 {
rpm := float64(time.Minute.Seconds()) / (totalRTTTime / (float64(totalRTTsCount)))
fmt.Printf("Total RTTs measured: %d\n", totalRTTsCount)
- fmt.Printf("RPM: %v\n", rpm)
+ fmt.Printf("RPM: %5.0f\n", rpm)
} else {
fmt.Printf("Error occurred calculating RPM -- no probe measurements received.\n")
}