This commit is contained in:
crusader 2018-07-04 12:14:25 +09:00
parent 8f73e25dd7
commit 20fddbf86e

View File

@ -3,7 +3,6 @@ package health
import ( import (
"crypto/tls" "crypto/tls"
"encoding/base64" "encoding/base64"
"fmt"
"net" "net"
cnsm "git.loafle.net/commons/service_matcher-go" cnsm "git.loafle.net/commons/service_matcher-go"
@ -30,7 +29,7 @@ func (s *SocketHealthCrawler) getConnection(config *ocmsc.SensorConfig) (net.Con
metaPortTypeKey := connection.MetaPortTypeKey metaPortTypeKey := connection.MetaPortTypeKey
metaCryptoTypeKey := connection.MetaCryptoTypeKey metaCryptoTypeKey := connection.MetaCryptoTypeKey
addr := fmt.Sprintf("%s:%s", ip, port) addr := net.JoinHostPort(ip, port.String())
network := "" network := ""
switch metaIPTypeKey { switch metaIPTypeKey {
@ -55,7 +54,8 @@ func (s *SocketHealthCrawler) getConnection(config *ocmsc.SensorConfig) (net.Con
return nil, err return nil, err
} }
if metaCryptoTypeKey == ocmm.MetaCryptoTypeEnumTLS.String() { switch metaCryptoTypeKey {
case ocmm.MetaCryptoTypeEnumTLS.String():
cfg := &tls.Config{ cfg := &tls.Config{
InsecureSkipVerify: true, InsecureSkipVerify: true,
ServerName: ip, ServerName: ip,
@ -67,6 +67,7 @@ func (s *SocketHealthCrawler) getConnection(config *ocmsc.SensorConfig) (net.Con
} }
conn = tlsConn conn = tlsConn
default:
} }
return conn, nil return conn, nil