This commit is contained in:
2025-03-27 13:30:42 +01:00
parent 13c33e1ff1
commit 72ab5a24a0

View File

@@ -8,12 +8,14 @@ import (
"io"
"net/http"
"strings"
"sync"
"time"
)
var (
shellyFlag = flag.String("s", "", "list shelly ips, comma seperated")
debugFlag = flag.Bool("d", false, "enable debug mode")
wg sync.WaitGroup
)
const (
@@ -102,6 +104,8 @@ func main() {
log.Fatal("no shelly ips specified")
}
wg := new(sync.WaitGroup)
for _, ip := range strings.Split(*shellyFlag, ",") {
go func() {
err := checkShelly(ip)
@@ -110,9 +114,13 @@ func main() {
}
}()
}
wg.Wait()
}
func checkShelly(ip string) error {
wg.Add(1)
defer wg.Done()
log.Infof("shelly worker %s started", ip)
for {