MCPcopy Create free account
hub / github.com/MengMengCode/GetRealityDomain / ScanWithConcurrency

Function ScanWithConcurrency

scanner.go:196–218  ·  view source on GitHub ↗

ScanWithConcurrency 并发扫描

(hostChan <-chan Host, geo *Geo)

Source from the content-addressed store, hash-verified

194
195// ScanWithConcurrency 并发扫描
196func ScanWithConcurrency(hostChan <-chan Host, geo *Geo) <-chan ScanResult {
197 resultChan := make(chan ScanResult, 1000)
198
199 // 使用sync.WaitGroup来等待所有工作协程完成
200 var wg sync.WaitGroup
201
202 // 启动工作协程
203 for i := 0; i < config.Thread; i++ {
204 wg.Add(1)
205 go func() {
206 defer wg.Done()
207 BatchScan(hostChan, resultChan, geo)
208 }()
209 }
210
211 // 启动一个协程来关闭结果通道
212 go func() {
213 wg.Wait() // 等待所有工作协程完成
214 close(resultChan)
215 }()
216
217 return resultChan
218}
219
220// ValidateRealityTarget 验证Reality目标的完整性
221func ValidateRealityTarget(result ScanResult) (bool, []string) {

Callers 1

scanAddressFunction · 0.85

Calls 1

BatchScanFunction · 0.85

Tested by

no test coverage detected