targetAddress, port, err := net.SplitHostPort(target)
if err != nil {
+ log.Errorf("Error splitting target address and port: %v", err)
return nil, err
}
ip, err := chooseProtocol(module.TCP.PreferredIPProtocol, targetAddress, registry)
if err != nil {
+ log.Errorf("Error choosing protocol: %v", err)
return nil, err
}
}
tlsConfig, err := config.NewTLSConfig(&module.TCP.TLSConfig)
if err != nil {
+ log.Errorf("Error creating TLS configuration: %v", err)
return nil, err
}
return tls.DialWithDialer(dialer, dialProtocol, dialTarget, tlsConfig)
deadline := time.Now().Add(module.Timeout)
conn, err := dialTCP(target, module, registry)
if err != nil {
+ log.Errorf("Error dialing TCP: %v", err)
return false
}
defer conn.Close()
// If a deadline cannot be set, better fail the probe by returning an error
// now rather than blocking forever.
if err := conn.SetDeadline(deadline); err != nil {
+ log.Errorf("Error setting deadline: %v", err)
return false
}
if module.TCP.TLS {