/usr/share/gocode/src/github.com/kotakanbe/go-pingscanner/example/main.go is in golang-github-kotakanbe-go-pingscanner-dev 0.1.0+git20160420.1.58e188a-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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)
}
}
}
|