diff --git a/ping/ping.go b/ping/ping.go index e460ba4..29771ad 100644 --- a/ping/ping.go +++ b/ping/ping.go @@ -21,12 +21,16 @@ func PingLocal255() int { deviceCount := 0 mu := &sync.Mutex{} - for i := 1; i < 255; i++ { + for i := 2; i < 255; i++ { wg.Add(1) go func(i int) { defer wg.Done() addr := fmt.Sprintf("%s.%d", network[:len(network)-2], i) + if addr == localIP.String() { + return + } + if ping(addr) { mu.Lock() deviceCount++