From d8d103843222d27ae44b9b9566d2e28c5d1478d8 Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Tue, 6 Aug 2019 19:41:13 +0100 Subject: [PATCH] Don't put v4 addresses in brackets Signed-off-by: Brian Brazil --- go.mod | 2 ++ go.sum | 4 ++++ prober/http.go | 6 +++++- vendor/github.com/alecthomas/template/go.mod | 1 + vendor/github.com/alecthomas/units/go.mod | 1 + vendor/modules.txt | 4 ++-- 6 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 vendor/github.com/alecthomas/template/go.mod create mode 100644 vendor/github.com/alecthomas/units/go.mod diff --git a/go.mod b/go.mod index 43eaa162..bfae6ec0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/prometheus/blackbox_exporter require ( + github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect + github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 // indirect github.com/go-kit/kit v0.8.0 github.com/kr/pretty v0.1.0 // indirect github.com/miekg/dns v1.1.14 diff --git a/go.sum b/go.sum index ecba72b3..2870e109 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,11 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= diff --git a/prober/http.go b/prober/http.go index 3fd3dd8a..757409da 100644 --- a/prober/http.go +++ b/prober/http.go @@ -318,7 +318,11 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr // Replace the host field in the URL with the IP we resolved. origHost := targetURL.Host if targetPort == "" { - targetURL.Host = "[" + ip.String() + "]" + if strings.Contains(ip.String(), ":") { + targetURL.Host = "[" + ip.String() + "]" + } else { + targetURL.Host = ip.String() + } } else { targetURL.Host = net.JoinHostPort(ip.String(), targetPort) } diff --git a/vendor/github.com/alecthomas/template/go.mod b/vendor/github.com/alecthomas/template/go.mod new file mode 100644 index 00000000..a70670ae --- /dev/null +++ b/vendor/github.com/alecthomas/template/go.mod @@ -0,0 +1 @@ +module github.com/alecthomas/template diff --git a/vendor/github.com/alecthomas/units/go.mod b/vendor/github.com/alecthomas/units/go.mod new file mode 100644 index 00000000..f5721732 --- /dev/null +++ b/vendor/github.com/alecthomas/units/go.mod @@ -0,0 +1 @@ +module github.com/alecthomas/units diff --git a/vendor/modules.txt b/vendor/modules.txt index 602c4648..489a333e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,7 +1,7 @@ -# github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc +# github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/alecthomas/template github.com/alecthomas/template/parse -# github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf +# github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 github.com/alecthomas/units # github.com/beorn7/perks v1.0.0 github.com/beorn7/perks/quantile