container_discovery/internal/discoverer/port.go
crusader c65fd4ab7d ing
2018-06-13 19:20:14 +09:00

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