Documentation
¶
Index ¶
- Variables
- func ListenForStopKey(ctx context.Context, cancel context.CancelFunc, done chan struct{})
- func TestSpeed(parentCtx context.Context, ip string, domain string, timeout time.Duration, ...) (float64, error)
- type FinalResult
- func RunDeepTest(ctx context.Context, outCount int, domain string, minSpeed float64, ...) []FinalResult
- func RunScanPool(ctx context.Context, ipGroups [][]string, workerCount int, domain string, ...) []FinalResult
- func ScanIP(ctx context.Context, ip string, domain string, timeout time.Duration, ...) FinalResult
- type Logger
- type ScanConfig
- type ScanStatus
- type SpeedResult
- type WSMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CancelScan context.CancelFunc Conf ScanConfig Status ScanStatus StatusMutex sync.Mutex )
定义全局变量
Functions ¶
func ListenForStopKey ¶
func ListenForStopKey(ctx context.Context, cancel context.CancelFunc, done chan struct{})
Types ¶
type FinalResult ¶
type FinalResult struct {
IP string `json:"address"`
Latency string `json:"-"` // 用于展示和 CSV 的字符串
DownloadMBs float64 `json:"-"` // 下载速度
RawLatency int64 `json:"-"` // 内部排序用的数值 (ms)
CreatedAt time.Time `json:"-"` // 记录测试时间
// contains filtered or unexported fields
}
结构体定义,用于 JSON 和 CSV 导出
func RunDeepTest ¶
func RunDeepTest(ctx context.Context, outCount int, domain string, minSpeed float64, finalResults []FinalResult, l Logger) []FinalResult
启动测速
type Logger ¶
type Logger interface {
WriteLog(string)
GetTheme() progressbar.Theme // 获取进度条主题
GetColorCodes() bool
}
Logger 定义了扫描器需要的日志能力 只要任何类型实现了这个 WriteLog 方法,就可以传给扫描器
type ScanConfig ¶
type ScanConfig struct {
NThreads int `json:"nthreads"` // 并发协程数
MinLatency int64 `json:"min_latency"` // 最小延迟
FinalCount int `json:"final_count"` // 最终结果保留的数
MinSpeed float64 `json:"min_speed"` // 最小下载速度
TestNum int `json:"test_num"` // 每段 IP 抽样数
FilePath string `json:"file_path"` // IP 来源文件路径
SniDomain string `json:"sni_domain"` // 测试的地址
OutPrefix string `json:"out_prefix"` // 输出文件的前缀
JsonPath string `json:"json_path"` // 追加文件的路径
AppendMode bool `json:"append_mode"` // 是否启用追加
ShowVer bool `json:"show_ver"` // 是否显示版本
ShowWeb bool `json:"show_web"` // 是否启用 web GUI
ShouldRun bool `json:"should_run"` // 运行扫描
DownloadV5 bool // 是否下载 v5-result
}
type ScanStatus ¶
type SpeedResult ¶
SpeedResult 存储测速结果
Click to show internal directories.
Click to hide internal directories.