handler

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrintNum = 30
)

Functions

func ConvertToString

func ConvertToString(data []CloudflareIPData) [][]string

ConvertToString

@Description: 结构体转化为字符串
@param data
@return [][]string

func ExportCSV

func ExportCSV(data []CloudflareIPData, filePath string)

ExportCSV

@Description: 导出结果为csv文件
@param data

func IPStrToIPAddr

func IPStrToIPAddr(ipStr string) *net.IPAddr

func IsIPv4

func IsIPv4(ip string) bool

func LoadIPRanges

func LoadIPRanges(ipList []string, testAll bool) []*net.IPAddr

LoadIPRanges

@Description: 解析ip数据段
@param ipList
@return []*net.IPAddr

Types

type CloudflareIPData

type CloudflareIPData struct {
	*PingData

	DownloadSpeed float64 `json:"downloadSpeed"`
	// contains filtered or unexported fields
}

func (*CloudflareIPData) GetDataStrList

func (cf *CloudflareIPData) GetDataStrList() []string

GetDataStrList

@Description: 获取结果字符串列表
@receiver cf
@return []string

func (*CloudflareIPData) GetLossRate

func (cf *CloudflareIPData) GetLossRate() float32

GetLossRate

@Description: 计算丢包率
@receiver cf
@return float32

type DownloadSpeedSet

type DownloadSpeedSet []CloudflareIPData

DownloadSpeedSet 下载速度排序

func (DownloadSpeedSet) Len

func (s DownloadSpeedSet) Len() int

Len

@Description: 实现sort接口
@receiver s
@return int

func (DownloadSpeedSet) Less

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

func (DownloadSpeedSet) PrettyPrint

func (s DownloadSpeedSet) PrettyPrint()

PrettyPrint

@Description: 格式化打印输出
@receiver s

func (DownloadSpeedSet) Swap

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

type IPRanges

type IPRanges struct {
	Ips     []*net.IPAddr
	Mask    string
	FirstIP net.IP
	IpNet   *net.IPNet
}

type PingData

type PingData struct {
	IP       *net.IPAddr   `json:"ip"`
	Sended   int           `json:"sended"`
	Received int           `json:"received"`
	Delay    time.Duration `json:"delay"`
}

type PingDelaySet

type PingDelaySet []CloudflareIPData

PingDelaySet 延迟丢包排序

func (PingDelaySet) FilterDelay

func (s PingDelaySet) FilterDelay(globalConfig *entity.TestOptions) (data PingDelaySet)

FilterDelay

@Description: 延迟条件过滤
@receiver s
@param globalConfig
@return data

func (PingDelaySet) FilterIPBan

func (s PingDelaySet) FilterIPBan(globalConfig *entity.TestOptions) (data PingDelaySet)

FilterIPBan

@Description: 墙内ipban 过滤
@receiver s
@param globalConfig
@return data

func (PingDelaySet) FilterLossRate

func (s PingDelaySet) FilterLossRate(globalConfig *entity.TestOptions) (data PingDelaySet)

FilterLossRate

@Description: 丢包条件过滤
@receiver s
@param globalConfig
@return data

func (PingDelaySet) FilterWantedISOIP

func (s PingDelaySet) FilterWantedISOIP(globalConfig *entity.TestOptions) (data PingDelaySet)

func (PingDelaySet) Len

func (s PingDelaySet) Len() int

Len 实现sort接口

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