utils

package
v0.0.0-...-f8112dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InputMaxDelay    = maxDelay
	InputMinDelay    = minDelay
	InputMaxLossRate = maxLossRate
	Output           = defaultOutput
	PrintNum         = 10
)

Functions

func ExportCsv

func ExportCsv(data []CloudflareIPData)

func GetCurrentBandwidth

func GetCurrentBandwidth() float64

带宽相关函数

func NoPrintResult

func NoPrintResult() bool

是否打印测试结果

func UpdateBandwidth

func UpdateBandwidth(speed int64)

Types

type Bar

type Bar struct {
	// contains filtered or unexported fields
}

func NewBar

func NewBar(count int, MyStrStart, MyStrEnd string) *Bar

func (*Bar) Done

func (b *Bar) Done()

func (*Bar) Grow

func (b *Bar) Grow(num int, val string)

type CloudflareIPData

type CloudflareIPData struct {
	*PingData

	DownloadSpeed float64
	// contains filtered or unexported fields
}

type DelayGroup

type DelayGroup struct {
	// contains filtered or unexported fields
}

延迟分组,每组内延迟差距在 5ms 以内

type DownloadSpeedSet

type DownloadSpeedSet []CloudflareIPData

下载速度排序

func (DownloadSpeedSet) Len

func (s DownloadSpeedSet) Len() int

func (DownloadSpeedSet) Less

func (s DownloadSpeedSet) Less(i, j int) bool

func (DownloadSpeedSet) Print

func (s DownloadSpeedSet) Print()

func (DownloadSpeedSet) Swap

func (s DownloadSpeedSet) Swap(i, j int)

type PingData

type PingData struct {
	IP       *net.IPAddr
	Sended   int
	Received int
	Delay    time.Duration
}

type PingDelaySet

type PingDelaySet []CloudflareIPData

延迟丢包排序

func (PingDelaySet) FilterDelay

func (s PingDelaySet) FilterDelay() (data PingDelaySet)

延迟条件过滤

func (PingDelaySet) FilterLossRate

func (s PingDelaySet) FilterLossRate() (data PingDelaySet)

丢包条件过滤

func (PingDelaySet) GroupAndShuffle

func (s PingDelaySet) GroupAndShuffle() PingDelaySet

对延迟测速结果进行分组并随机化

func (PingDelaySet) Len

func (s PingDelaySet) Len() int

func (PingDelaySet) Less

func (s PingDelaySet) Less(i, j int) bool

func (PingDelaySet) Swap

func (s PingDelaySet) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL