2024-09-18 07:16:56 +00:00
|
|
|
package concurrency
|
|
|
|
|
|
|
|
type WebsiteChecker func(string) bool
|
|
|
|
|
|
|
|
func CheckWebsites(wc WebsiteChecker, urls []string) map[string]bool {
|
|
|
|
results := make(map[string]bool)
|
|
|
|
|
|
|
|
for _, url := range urls {
|
2024-09-18 07:26:39 +00:00
|
|
|
go func() {
|
|
|
|
results[url] = wc(url)
|
|
|
|
}()
|
2024-09-18 07:16:56 +00:00
|
|
|
}
|
|
|
|
return results
|
|
|
|
}
|