mirror of
https://github.com/XIU2/CloudflareSpeedTest.git
synced 2026-03-04 05:17:06 +08:00
新增 HTTPing 延迟测速模式(beta); 新增 IP 机场三字码 colo 筛选功能(beta) (#282)
这两个功能目前仅为测试版,后续会大幅改动,以最终成品为准~
This commit is contained in:
@@ -1,19 +1,25 @@
|
||||
package utils
|
||||
|
||||
import "github.com/cheggaaa/pb/v3"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cheggaaa/pb/v3"
|
||||
)
|
||||
|
||||
type Bar struct {
|
||||
pb *pb.ProgressBar
|
||||
}
|
||||
|
||||
func NewBar(count int) *Bar {
|
||||
return &Bar{pb.Simple.Start(count)}
|
||||
func NewBar(count int, MyStrStart, MyStrEnd string) *Bar {
|
||||
tmpl := fmt.Sprintf(`{{counters . }}{{ bar . "[" "-" (cycle . "↖" "↗" "↘" "↙" ) "_" "]"}} %s {{string . "MyStr" | green}} %s `, MyStrStart, MyStrEnd)
|
||||
bar := pb.ProgressBarTemplate(tmpl).Start(count)
|
||||
return &Bar{pb: bar}
|
||||
}
|
||||
|
||||
func (b *Bar) Grow(num int) {
|
||||
b.pb.Add(num)
|
||||
func (b *Bar) Grow(num int, MyStrVal string) {
|
||||
b.pb.Set("MyStr", MyStrVal).Add(num)
|
||||
}
|
||||
|
||||
func (b *Bar) Done() {
|
||||
b.pb.Finish()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user