CheckDomains 批量检测域名(移除并发控制,由调用方管理)
(ctx context.Context, domains []string)
| 82 | |
| 83 | // CheckDomains 批量检测域名(移除并发控制,由调用方管理) |
| 84 | func (e *Engine) CheckDomains(ctx context.Context, domains []string) ([]*types.DetectionResult, error) { |
| 85 | if !e.running { |
| 86 | return nil, fmt.Errorf("引擎未运行") |
| 87 | } |
| 88 | |
| 89 | if len(domains) == 0 { |
| 90 | return []*types.DetectionResult{}, nil |
| 91 | } |
| 92 | |
| 93 | // 移除Engine层的并发控制,由Batch Manager统一管理 |
| 94 | results := make([]*types.DetectionResult, len(domains)) |
| 95 | |
| 96 | for i, domain := range domains { |
| 97 | // 直接执行检测,不进行并发控制 |
| 98 | result, err := e.pipeline.Execute(ctx, domain) |
| 99 | if err != nil { |
| 100 | result = &types.DetectionResult{ |
| 101 | Domain: domain, |
| 102 | Error: err, |
| 103 | } |
| 104 | } |
| 105 | results[i] = result |
| 106 | } |
| 107 | |
| 108 | return results, nil |
| 109 | } |
| 110 | |
| 111 | // CheckDomainsStream 流式批量检测域名 |
| 112 | func (e *Engine) CheckDomainsStream(ctx context.Context, domains []string) (<-chan *types.DetectionResult, error) { |
no test coverage detected