From 6273385618b3a9ef3f37e1e7022c4c4cbb38358e Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 12 May 2020 15:22:27 +0300 Subject: [PATCH] app/vmagent/remotewrite: properly dial TCP6 addresses set via `-remoteWrite.url` Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/469 --- app/vmagent/remotewrite/statconn.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/vmagent/remotewrite/statconn.go b/app/vmagent/remotewrite/statconn.go index 6507774ef..581dd8410 100644 --- a/app/vmagent/remotewrite/statconn.go +++ b/app/vmagent/remotewrite/statconn.go @@ -4,12 +4,17 @@ import ( "net" "sync/atomic" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/netutil" "github.com/VictoriaMetrics/fasthttp" "github.com/VictoriaMetrics/metrics" ) -func statDial(addr string) (net.Conn, error) { - conn, err := fasthttp.Dial(addr) +func statDial(addr string) (conn net.Conn, err error) { + if netutil.TCP6Enabled() { + conn, err = fasthttp.DialDualStack(addr) + } else { + conn, err = fasthttp.Dial(addr) + } dialsTotal.Inc() if err != nil { dialErrors.Inc()