2017-11-18 08:23:39 +00:00
|
|
|
package ipv4
|
|
|
|
|
2017-11-21 05:31:17 +00:00
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
|
|
|
|
"git.loafle.net/overflow/overflow_discovery/api/module/discovery/model"
|
|
|
|
)
|
2017-11-18 08:23:39 +00:00
|
|
|
|
2017-11-18 12:08:08 +00:00
|
|
|
func ScanPort(host *model.Host, dp *model.DiscoveryPort, resultChan chan interface{}, errChan chan error, stopChan chan struct{}) {
|
2017-11-21 05:31:17 +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)
|
|
|
|
}
|
2017-11-18 08:23:39 +00:00
|
|
|
|
2017-11-21 05:31:17 +00:00
|
|
|
wg.Wait()
|
2017-11-18 08:23:39 +00:00
|
|
|
}
|