From 4d4b9b6fa68fdd696d15b7101ec7b353d53dc7a0 Mon Sep 17 00:00:00 2001 From: "insanity@loafle.com" Date: Wed, 17 May 2017 12:26:24 +0900 Subject: [PATCH] added processing err --- crawler.go | 4 +--- .../snmpv2c_protocol_crawler.go | 3 ++- socket_health_crawler.go | 9 ++++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/crawler.go b/crawler.go index 7325b14..98bdc2a 100644 --- a/crawler.go +++ b/crawler.go @@ -37,7 +37,6 @@ func (c *CrawlerImpl) Init(data []byte) ([]byte, error) { log.Fatal(err) } - // load all file in path return json.Marshal(true) } @@ -55,7 +54,6 @@ func (c *CrawlerImpl) Remove(id string) ([]byte, error) { return json.Marshal(true) } func (c *CrawlerImpl) Get(id string) ([]byte, error) { - if c.internal != nil { out, err := c.internal.Internal(c.GetConfig(id)) if err != nil { @@ -64,7 +62,7 @@ func (c *CrawlerImpl) Get(id string) ([]byte, error) { } return out, nil } - return nil, errors.New("Not Assign") + return nil, errors.New("Not Assigned") } // internal methods diff --git a/health_crawler/snmpv2c_protocol_crawler_go/snmpv2c_protocol_crawler.go b/health_crawler/snmpv2c_protocol_crawler_go/snmpv2c_protocol_crawler.go index 6bafbe8..33c8853 100644 --- a/health_crawler/snmpv2c_protocol_crawler_go/snmpv2c_protocol_crawler.go +++ b/health_crawler/snmpv2c_protocol_crawler_go/snmpv2c_protocol_crawler.go @@ -5,6 +5,7 @@ import ( "loafle.com/overflow/commons_go/matcher/snmp" "loafle.com/overflow/crawler_go" config "loafle.com/overflow/agent_api/config_manager" + "log" ) type SNMPV2CHeahthCrawler struct { @@ -12,7 +13,7 @@ type SNMPV2CHeahthCrawler struct { } func (r *SNMPV2CHeahthCrawler)Internal(params config.Config) ([]byte, error) { - + log.Println("????????????????????????????????") b, err := r.CheckHeahth(params) if err != nil { return nil, err diff --git a/socket_health_crawler.go b/socket_health_crawler.go index e5b52fb..8030cde 100644 --- a/socket_health_crawler.go +++ b/socket_health_crawler.go @@ -19,9 +19,9 @@ func (s *SocketHeahthCrawler) SetMatcher(m matcher.Matcher) { } func (s *SocketHeahthCrawler) getConnection(params config.Config) (net.Conn, error) { - + connection := params.Target.Connection - + ip := connection.Ip port := connection.Port portType := connection.PortType @@ -55,16 +55,15 @@ func (s *SocketHeahthCrawler) getConnection(params config.Config) (net.Conn, err } func (s *SocketHeahthCrawler) CheckHeahth(params config.Config) (bool, error) { - conn, err := s.getConnection(params) if err != nil { return false, err } defer conn.Close() - + connection := params.Target.Connection info := scaninfo.NewScanInfoImpl(connection.Ip,connection.Port) - + if s.m.IsPrePacket() == true { bytes := make([]byte, 1024) n, _ := conn.Read(bytes)