ing
This commit is contained in:
parent
163a6a92d2
commit
6b10353dd0
18
Gopkg.lock
generated
18
Gopkg.lock
generated
|
@ -34,7 +34,7 @@
|
|||
"protocol/json",
|
||||
"registry"
|
||||
]
|
||||
revision = "1092f7a7ae44ef2f907579af217f1a594e48959c"
|
||||
revision = "dcc3af07239b3f6fcbae3529bcb52c522b02053d"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -92,7 +92,7 @@
|
|||
"time/scheduler/storage",
|
||||
"time/scheduler/task"
|
||||
]
|
||||
revision = "1966a985759721fd451171a78a0b8f4524afc644"
|
||||
revision = "4d4017d214d2a8fdde59d774254f421991fabe7e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -102,15 +102,15 @@
|
|||
"config/probe",
|
||||
"core/annotation",
|
||||
"core/config",
|
||||
"core/constants",
|
||||
"core/interfaces",
|
||||
"core/util",
|
||||
"model/data",
|
||||
"model/discovery",
|
||||
"model/meta",
|
||||
"model/sensorconfig",
|
||||
"service/probe"
|
||||
]
|
||||
revision = "078a39712d33c131303cf2705cca185da18cc196"
|
||||
revision = "687985e7f2122d12e43a0111f13d6df9921c3d82"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -120,7 +120,7 @@
|
|||
"client",
|
||||
"service"
|
||||
]
|
||||
revision = "61644fd5e4218ec577aa2a9b61c1e5f12bda5fab"
|
||||
revision = "19dfca7aa5de04aceec13b8f81d05a40c7a25254"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -183,8 +183,8 @@
|
|||
[[projects]]
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert"]
|
||||
revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
|
||||
version = "v1.2.1"
|
||||
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
|
||||
version = "v1.2.2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/valyala/fasthttp"
|
||||
|
@ -231,7 +231,7 @@
|
|||
"poly1305",
|
||||
"ssh"
|
||||
]
|
||||
revision = "94e3fad7f1b4eed4ec147751ad6b4c4d33f00611"
|
||||
revision = "8ac0e0d97ce45cd83d1d7243c060cb8461dda5e9"
|
||||
|
||||
[[projects]]
|
||||
name = "gopkg.in/yaml.v2"
|
||||
|
@ -242,6 +242,6 @@
|
|||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "4347c825e10ed37c42eb74f4e8e696611fbfffe2174e443b452c5bb0086d04fe"
|
||||
inputs-digest = "97021d754c9c62c90d33dc569fc8e4a6f66459dd3f8b220910bb3fb44f90a032"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
cnsm "git.loafle.net/commons/service_matcher-go"
|
||||
cuej "git.loafle.net/commons/util-go/encoding/json"
|
||||
ocmm "git.loafle.net/overflow/commons-go/model/meta"
|
||||
ocmsc "git.loafle.net/overflow/commons-go/model/sensorconfig"
|
||||
"git.loafle.net/overflow/crawler-go"
|
||||
)
|
||||
|
@ -25,19 +26,38 @@ func (s *SocketHeahthCrawler) SetMatcher(m cnsm.Matcher) {
|
|||
func (s *SocketHeahthCrawler) getConnection(config *ocmsc.SensorConfig) (net.Conn, error) {
|
||||
connection := config.Target.Connection
|
||||
|
||||
metaIPType := connection.MetaIPType
|
||||
ip := connection.IP
|
||||
port := connection.Port
|
||||
portType := connection.PortType
|
||||
ssl := connection.SSL
|
||||
metaPortType := connection.MetaPortType
|
||||
metaCryptoType := connection.MetaCryptoType
|
||||
|
||||
addr := fmt.Sprintf("%s:%s", ip, port)
|
||||
|
||||
conn, err := net.Dial(portType.String(), addr)
|
||||
network := ""
|
||||
switch ocmm.ToMetaIPTypeEnum(metaIPType) {
|
||||
case ocmm.MetaIPTypeEnumV6:
|
||||
switch ocmm.ToMetaPortTypeEnum(metaPortType) {
|
||||
case ocmm.MetaPortTypeEnumUDP:
|
||||
network = "udp6"
|
||||
default:
|
||||
network = "tcp6"
|
||||
}
|
||||
default:
|
||||
switch ocmm.ToMetaPortTypeEnum(metaPortType) {
|
||||
case ocmm.MetaPortTypeEnumUDP:
|
||||
network = "udp"
|
||||
default:
|
||||
network = "tcp"
|
||||
}
|
||||
}
|
||||
|
||||
conn, err := net.Dial(network, addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if ssl {
|
||||
if ocmm.ToMetaCryptoTypeEnum(metaCryptoType) == ocmm.MetaCryptoTypeEnumTLS {
|
||||
cfg := &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
ServerName: ip,
|
||||
|
|
Loading…
Reference in New Issue
Block a user