probe/discoverer/host.go

27 lines
738 B
Go
Raw Normal View History

2018-08-13 07:19:59 +00:00
package discoverer
import (
"fmt"
omd "git.loafle.net/overflow/model/discovery"
omm "git.loafle.net/overflow/model/meta"
"git.loafle.net/overflow_scanner/probe/discoverer/ipv4"
"git.loafle.net/overflow_scanner/probe/discoverer/ipv6"
)
func scanHost(zone *omd.Zone, dh *omd.DiscoverHost, resultChan chan interface{}, errChan chan error, doneChan chan<- struct{}, stopChan chan struct{}) {
defer func() {
doneChan <- struct{}{}
}()
switch omm.ToMetaIPTypeEnum(dh.MetaIPType) {
case omm.MetaIPTypeEnumV4:
ipv4.ScanHost(zone, dh, resultChan, errChan, stopChan)
case omm.MetaIPTypeEnumV6:
ipv6.ScanHost(zone, dh, resultChan, errChan, stopChan)
default:
errChan <- fmt.Errorf("Discovery: Not supported MetaIPType")
}
}