CheckDomains 批量检测域名
(ctx context.Context, domains []string)
| 87 | |
| 88 | // CheckDomains 批量检测域名 |
| 89 | func (bm *Manager) CheckDomains(ctx context.Context, domains []string) ([]*types.DetectionResult, error) { |
| 90 | if !bm.running { |
| 91 | return nil, fmt.Errorf("批量管理器未运行") |
| 92 | } |
| 93 | |
| 94 | if len(domains) == 0 { |
| 95 | return []*types.DetectionResult{}, nil |
| 96 | } |
| 97 | |
| 98 | startTime := time.Now() |
| 99 | |
| 100 | // 使用流式检测显示实时进度 |
| 101 | results, err := bm.CheckDomainsWithProgress(ctx, domains) |
| 102 | if err != nil { |
| 103 | return nil, err |
| 104 | } |
| 105 | |
| 106 | // 生成批量报告 |
| 107 | batchReport := bm.generateBatchReport(results, startTime, time.Now()) |
| 108 | |
| 109 | // 打印报告 |
| 110 | fmt.Println(bm.formatBatchReport(batchReport)) |
| 111 | |
| 112 | return results, nil |
| 113 | } |
| 114 | |
| 115 | // CheckDomainsWithProgress 带进度显示的并发批量检测 |
| 116 | func (bm *Manager) CheckDomainsWithProgress(ctx context.Context, domains []string) ([]*types.DetectionResult, error) { |
nothing calls this directly
no test coverage detected