smaller range

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
Jess Frazelle 2018-07-08 08:16:11 -04:00
parent b99aa9d325
commit 8351a72c8b
No known key found for this signature in database
GPG Key ID: 18F3685C0022BFF3

View File

@ -21,12 +21,14 @@ import (
const (
cidr = "0.0.0.0/0"
beginPort = 80
endPort = 65535
arinAPIEndpoint = "http://whois.arin.net/rest/ip/%s"
)
var (
ports = []int{80, 443, 9001, 8001}
)
func main() {
// On ^C, or SIGTERM handle exit.
c := make(chan os.Signal, 1)
@ -44,7 +46,7 @@ func main() {
log.SetFlags(0)
log.SetOutput(ioutil.Discard)
logrus.Infof("Scanning for Kubernetes Dashboards and API Servers on %s over port range %d-%d", cidr, beginPort, endPort)
logrus.Infof("Scanning for Kubernetes Dashboards and API Servers on %s over port range %#v", cidr, ports)
logrus.Infof("This may take a bit...")
startTime := time.Now()
@ -56,7 +58,7 @@ func main() {
var wg sync.WaitGroup
for ip := ip.Mask(ipnet.Mask); ipnet.Contains(ip); inc(ip) {
for port := beginPort; port <= endPort; port++ {
for _, port := range ports {
wg.Add(1)
go func(ip string, port int) {
defer wg.Done()