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