mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-05 22:32:20 +01:00
lib/promscrape: properly connect to TCP6 addresses if -enableTCP6
is set
This commit is contained in:
parent
21b91599c2
commit
42d563934b
@ -4,12 +4,17 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/netutil"
|
||||||
"github.com/VictoriaMetrics/fasthttp"
|
"github.com/VictoriaMetrics/fasthttp"
|
||||||
"github.com/VictoriaMetrics/metrics"
|
"github.com/VictoriaMetrics/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
func statDial(addr string) (net.Conn, error) {
|
func statDial(addr string) (conn net.Conn, err error) {
|
||||||
conn, err := fasthttp.Dial(addr)
|
if netutil.TCP6Enabled() {
|
||||||
|
conn, err = fasthttp.DialDualStack(addr)
|
||||||
|
} else {
|
||||||
|
conn, err = fasthttp.Dial(addr)
|
||||||
|
}
|
||||||
dialsTotal.Inc()
|
dialsTotal.Inc()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dialErrors.Inc()
|
dialErrors.Inc()
|
||||||
|
Loading…
Reference in New Issue
Block a user