A goroutine can spin off at the beginning that checks sites every few hours. That check could consist of a few other goroutines that download a reasonable number of homepages (three?) concurrently and search through the content for the necessary strings.
webringDomain
config option for the webring's domain to keep
from hardcoding anythingcheckSite()
can be executed
on multiple sites concurrently without fear of multiple processes
writing to the file at the same time (not sure what would happen but I
assume it wouldn't be good).func (m model) checkSite(rawHost string) {
res, err := http.Get(rawHost)
if err != nil {
// Append to error.log saying there was an error getting rawHost
// Append err to line above
}
body, err := io.ReadAll(res.Body)
res.Body.Close()
if res.StatusCode > 299 {
// Append to error.log saying rawHost responded with res.StatusCode
}
if err != nil {
log.Println(err)
}
escapedHost := url.QueryEscape(rawHost)
nextString := "https://" + m.webringDomain + "/next?host=" + escapedHost
previousString := "https://" + m.webringDomain + "/previous?host=" + escapedHost
if strings.Contains(body, nextString) && strings.Contains(body, previousString) && strings.Contains(body, m.webringDomain) {
// Append to success.log saying rawHost was checked and is good
} else {
// Append to error.log saying rawHost was checked and is not good
}
}