probe/discoverer/host.go
2018-08-13 16:19:59 +09:00

27 lines
738 B
Go

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")
}
}