2018-04-19 11:36:56 +00:00
|
|
|
package ipv4
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
|
2018-04-26 09:00:24 +00:00
|
|
|
ocmd "git.loafle.net/overflow/commons-go/model/discovery"
|
2018-04-19 11:36:56 +00:00
|
|
|
)
|
|
|
|
|
2018-04-27 16:20:01 +00:00
|
|
|
func ScanPort(host *ocmd.Host, dp *ocmd.DiscoverPort, resultChan chan interface{}, errChan chan error, stopChan chan struct{}) {
|
2018-04-19 11:36:56 +00:00
|
|
|
var wg sync.WaitGroup
|
|
|
|
|
|
|
|
if dp.IncludeTCP {
|
|
|
|
wg.Add(1)
|
|
|
|
go scanPortTCP(host, dp, resultChan, errChan, stopChan, &wg)
|
|
|
|
}
|
|
|
|
|
|
|
|
if dp.IncludeUDP {
|
|
|
|
wg.Add(1)
|
|
|
|
go scanPortUDP(host, dp, resultChan, errChan, stopChan, &wg)
|
|
|
|
}
|
|
|
|
|
|
|
|
wg.Wait()
|
|
|
|
}
|