Documentation
¶
Overview ¶
Package pingscanner scan alive IPs of the given CIDR range in parallel.
Example usage:
package main
import (
"fmt" ps "github.com/kotakanbe/go-pingscanner"
)
func main() {
scanner := ps.PingScanner{
CIDR: "192.168.11.0/24",
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)
}
}
}
Index ¶
Constants ¶
View Source
const Name string = "go-pingscanner"
Name ... Name
View Source
const Version string = "0.1.0"
Version ... Version
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PingScanner ¶
type PingScanner struct {
// CIDR (ex. 192.168.0.0/24)
CIDR string
// Number of concurrency ping process. (ex. 100)
NumOfConcurrency int
// ping command options. (ex. []string{"-c1", "-t1"})
PingOptions []string
}
PingScanner has information of Scanning.
func (PingScanner) Scan ¶
func (d PingScanner) Scan() (aliveIPs []string, err error)
Scan ping to hosts in CIDR range.
Click to show internal directories.
Click to hide internal directories.