body = recorder.Body.String()
if protocol == "udp" {
if !result {
- t.Fatalf("DNS test connection with protocol unspecified failed, expected success.", protocol)
+ t.Fatalf("DNS test connection with protocol %s failed, expected success.", protocol)
}
} else {
if result {
- t.Fatalf("DNS test connection with protocol unspecified succeeded, expected failure.", protocol)
+ t.Fatalf("DNS test connection with protocol %s succeeded, expected failure.", protocol)
}
}
if !strings.Contains(body, "probe_ip_protocol 6\n") {
dialProtocol = module.HTTP.Protocol
if module.HTTP.Protocol == "tcp" {
- target_url, err := url.Parse(target)
+ targetURL, err := url.Parse(target)
if err != nil {
return false
}
- target_host, _, err := net.SplitHostPort(target_url.Host)
+ targetHost, _, err := net.SplitHostPort(targetURL.Host)
// If split fails, assuming it's a hostname without port part
if err != nil {
- target_host = target_url.Host
+ targetHost = targetURL.Host
}
- ip, err := net.ResolveIPAddr(module.HTTP.PreferredIpProtocol, target_host)
+ ip, err := net.ResolveIPAddr(module.HTTP.PreferredIpProtocol, targetHost)
if err != nil {
- ip, err = net.ResolveIPAddr(fallbackProtocol, target_host)
+ ip, err = net.ResolveIPAddr(fallbackProtocol, targetHost)
if err != nil {
return false
}
import (
"bytes"
"fmt"
- "golang.org/x/net/icmp"
- "golang.org/x/net/ipv4"
- "golang.org/x/net/ipv6"
"net"
"net/http"
"os"
"sync"
"time"
+ "golang.org/x/net/icmp"
+ "golang.org/x/net/ipv4"
+ "golang.org/x/net/ipv6"
+
"github.com/prometheus/common/log"
)
func getICMPSequence() uint16 {
icmpSequenceMutex.Lock()
defer icmpSequenceMutex.Unlock()
- icmpSequence += 1
+ icmpSequence++
return icmpSequence
}
return
}
}
- return
}