fixed discovery

This commit is contained in:
snoop
2017-08-09 18:02:40 +09:00
parent 4913cff255
commit 919cc9faa7
11 changed files with 139 additions and 92 deletions

View File

@@ -1,20 +1,34 @@
package scaninfo
import "git.loafle.net/overflow/overflow_probe/discovery/discovery/types"
type ServiceScanInfo interface {
SetHistory(history string)
SetHistory(history *types.ServiceScanHistory)
GetHistories() []*types.ServiceScanHistory
GetPort() string
GetIP() string
GetDiscoveryPort() *types.DiscoveryPort
}
type ScanInfoImpl struct {
Ip string
Port string
//Ip string
//Port string
//histories []string
histories []*types.ServiceScanHistory
discoveryPort *types.DiscoveryPort
}
func (s *ScanInfoImpl) SetHistory(history string) {}
func (s *ScanInfoImpl) GetPort() string { return s.Port }
func (s *ScanInfoImpl) GetIP() string { return s.Ip }
func NewScanInfoImpl(ip string, port string) *ScanInfoImpl {
return &ScanInfoImpl{Ip: ip, Port: port}
func (s *ScanInfoImpl) SetHistory(history *types.ServiceScanHistory) {
//s.histories = append(s.histories, history)
s.histories = append(s.histories, history)
}
func (s *ScanInfoImpl) GetPort() string { return s.discoveryPort.Port_ }
func (s *ScanInfoImpl) GetIP() string { return s.discoveryPort.Host.Ip_ }
func (s *ScanInfoImpl) GetDiscoveryPort() *types.DiscoveryPort { return s.discoveryPort }
func (s *ScanInfoImpl) GetHistories() []*types.ServiceScanHistory { return s.histories }
func NewScanInfoImpl(discoveryPort *types.DiscoveryPort) *ScanInfoImpl {
return &ScanInfoImpl{discoveryPort:discoveryPort}
}