From 20fddbf86e64d325b57102d79e52a161e862333f Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 4 Jul 2018 12:14:25 +0900 Subject: [PATCH] ing --- crawler/health/SocketHeahthCrawler.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crawler/health/SocketHeahthCrawler.go b/crawler/health/SocketHeahthCrawler.go index 3b380ce..630bb4c 100644 --- a/crawler/health/SocketHeahthCrawler.go +++ b/crawler/health/SocketHeahthCrawler.go @@ -3,7 +3,6 @@ package health import ( "crypto/tls" "encoding/base64" - "fmt" "net" cnsm "git.loafle.net/commons/service_matcher-go" @@ -30,7 +29,7 @@ func (s *SocketHealthCrawler) getConnection(config *ocmsc.SensorConfig) (net.Con metaPortTypeKey := connection.MetaPortTypeKey metaCryptoTypeKey := connection.MetaCryptoTypeKey - addr := fmt.Sprintf("%s:%s", ip, port) + addr := net.JoinHostPort(ip, port.String()) network := "" switch metaIPTypeKey { @@ -55,7 +54,8 @@ func (s *SocketHealthCrawler) getConnection(config *ocmsc.SensorConfig) (net.Con return nil, err } - if metaCryptoTypeKey == ocmm.MetaCryptoTypeEnumTLS.String() { + switch metaCryptoTypeKey { + case ocmm.MetaCryptoTypeEnumTLS.String(): cfg := &tls.Config{ InsecureSkipVerify: true, ServerName: ip, @@ -67,6 +67,7 @@ func (s *SocketHealthCrawler) getConnection(config *ocmsc.SensorConfig) (net.Con } conn = tlsConn + default: } return conn, nil