probe/discovery/service/service.go
2018-08-31 21:56:36 +09:00

25 lines
617 B
Go

package service
import (
omd "git.loafle.net/overflow/model/discovery"
omm "git.loafle.net/overflow/model/meta"
"git.loafle.net/overflow_scanner/probe/discovery/session"
)
func Scan(discoverySession session.DiscoverySession, targetPort *omd.Port) error {
if nil == targetPort || nil == discoverySession.DiscoverService() {
return nil
}
metaPortTypeEnum := omm.ToMetaPortTypeEnum(targetPort.MetaPortType)
switch metaPortTypeEnum {
case omm.MetaPortTypeEnumTCP:
return scanTCP(discoverySession, targetPort)
case omm.MetaPortTypeEnumUDP:
return scanUDP(discoverySession, targetPort)
}
return nil
}