MCPcopy Create free account
hub / github.com/SamNet-dev/snix / ProbeSNIs

Function ProbeSNIs

scanner/sni.go:160–181  ·  view source on GitHub ↗

ProbeSNIs runs ProbeSNI for every sni in the slice concurrently bounded by cfg.Concurrency. Results are returned in the same order as input.

(ctx context.Context, snis []string, cfg ProbeConfig, onResult func(Result))

Source from the content-addressed store, hash-verified

158// ProbeSNIs runs ProbeSNI for every sni in the slice concurrently bounded
159// by cfg.Concurrency. Results are returned in the same order as input.
160func ProbeSNIs(ctx context.Context, snis []string, cfg ProbeConfig, onResult func(Result)) []Result {
161 cfg.defaults()
162 sem := make(chan struct{}, cfg.Concurrency)
163 results := make([]Result, len(snis))
164 var wg sync.WaitGroup
165 for i, sni := range snis {
166 i, sni := i, sni
167 wg.Add(1)
168 sem <- struct{}{}
169 go func() {
170 defer wg.Done()
171 defer func() { <-sem }()
172 r := ProbeSNI(ctx, sni, cfg)
173 results[i] = r
174 if onResult != nil {
175 onResult(r)
176 }
177 }()
178 }
179 wg.Wait()
180 return results
181}
182
183// classifyDialErr maps net.Dialer errors into the Outcome taxonomy.
184func classifyDialErr(err error) (Outcome, string) {

Callers 5

startSNIMethod · 0.92
newScanSNICmdFunction · 0.92
newScanAllCmdFunction · 0.92
runWizardScansFunction · 0.92
TestProbeSNIsConcurrentFunction · 0.85

Calls 3

ProbeSNIFunction · 0.85
defaultsMethod · 0.80
AddMethod · 0.80

Tested by 1

TestProbeSNIsConcurrentFunction · 0.68