MCPcopy
hub / github.com/XIU2/CloudflareSpeedTest / toString

Method toString

utils/csv.go:62–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60}
61
62func (cf *CloudflareIPData) toString() []string {
63 result := make([]string, 7)
64 result[0] = cf.IP.String()
65 result[1] = strconv.Itoa(cf.Sended)
66 result[2] = strconv.Itoa(cf.Received)
67 result[3] = strconv.FormatFloat(float64(cf.getLossRate()), 'f', 2, 32)
68 result[4] = strconv.FormatFloat(cf.Delay.Seconds()*1000, 'f', 2, 32)
69 result[5] = strconv.FormatFloat(cf.DownloadSpeed/1024/1024, 'f', 2, 32)
70 // 如果 Colo 为空,则使用 "N/A" 表示
71 if cf.Colo == "" {
72 result[6] = "N/A"
73 } else {
74 result[6] = cf.Colo
75 }
76 return result
77}
78
79func ExportCsv(data []CloudflareIPData) {
80 if noOutput() || len(data) == 0 {

Callers 1

convertToStringFunction · 0.80

Calls 1

getLossRateMethod · 0.95

Tested by

no test coverage detected