File: main.go

package info (click to toggle)
golang-github-kotakanbe-go-pingscanner 0.1.0%2Bgit20160420.1.58e188a-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, experimental
  • size: 96 kB
  • sloc: makefile: 5
file content (29 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main

import (
	"fmt"

	ps "github.com/kotakanbe/go-pingscanner"
)

func main() {
	scanner := ps.PingScanner{
		//  CIDR: "192.168.11.0/24",
		CIDR: "192.168.11.2/32",
		PingOptions: []string{
			"-c1",
			"-t1",
		},
		NumOfConcurrency: 100,
	}
	if aliveIPs, err := scanner.Scan(); err != nil {
		fmt.Println(err)
	} else {
		if len(aliveIPs) < 1 {
			fmt.Println("no alive hosts")
		}
		for _, ip := range aliveIPs {
			fmt.Println(ip)
		}
	}
}