probe/discovery/service/service.go

25 lines
617 B
Go
Raw Normal View History

2018-08-31 10:53:33 +00:00
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 {
2018-08-31 12:56:36 +00:00
if nil == targetPort || nil == discoverySession.DiscoverService() {
return nil
}
2018-08-31 10:53:33 +00:00
metaPortTypeEnum := omm.ToMetaPortTypeEnum(targetPort.MetaPortType)
switch metaPortTypeEnum {
case omm.MetaPortTypeEnumTCP:
return scanTCP(discoverySession, targetPort)
case omm.MetaPortTypeEnumUDP:
return scanUDP(discoverySession, targetPort)
}
return nil
}