27 lines
799 B
Go
27 lines
799 B
Go
package discoverer
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
ocmd "git.loafle.net/overflow/commons-go/model/discovery"
|
|
ocmm "git.loafle.net/overflow/commons-go/model/meta"
|
|
"git.loafle.net/overflow/container_discovery/internal/discoverer/ipv4"
|
|
"git.loafle.net/overflow/container_discovery/internal/discoverer/ipv6"
|
|
)
|
|
|
|
func scanPort(host *ocmd.Host, dp *ocmd.DiscoverPort, resultChan chan interface{}, errChan chan error, doneChan chan<- struct{}, stopChan chan struct{}) {
|
|
defer func() {
|
|
doneChan <- struct{}{}
|
|
}()
|
|
|
|
switch ocmm.ToMetaIPTypeEnum(host.MetaIPType) {
|
|
case ocmm.MetaIPTypeEnumV4:
|
|
ipv4.ScanPort(host, dp, resultChan, errChan, stopChan)
|
|
case ocmm.MetaIPTypeEnumV6:
|
|
ipv6.ScanPort(host, dp, resultChan, errChan, stopChan)
|
|
default:
|
|
errChan <- fmt.Errorf("Discovery: Not supported MetaIPType")
|
|
}
|
|
|
|
}
|