From 3c59340e315d860f1c39d3d41e808770d0b91697 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Mon, 12 Dec 2022 10:02:04 -0500 Subject: [Feature] Add support for test_endpoint When a test_endpoint is returned in the config for a test, all requests will be sent to that host but the :authority pseudo header (nee: Host: message header) will contain the host specified in the various `_url` fields of the config data. --- rpm/rpm.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'rpm') diff --git a/rpm/rpm.go b/rpm/rpm.go index db92571..eb10ec2 100644 --- a/rpm/rpm.go +++ b/rpm/rpm.go @@ -56,7 +56,8 @@ func addFlows( } type ProbeConfiguration struct { - URL string + URL string + Host string } type ProbeDataPoint struct { @@ -111,6 +112,7 @@ func Probe( waitGroup *sync.WaitGroup, client *http.Client, probeUrl string, + probeHost string, // optional: for use with a test_endpoint probeType ProbeType, result *chan ProbeDataPoint, debugging *debug.DebugWithPrefix, @@ -138,6 +140,10 @@ func Probe( return err } + // To support test_endpoint + if len(probeHost) != 0 { + probe_req.Host = probeHost + } // Used to disable compression probe_req.Header.Set("Accept-Encoding", "identity") @@ -296,6 +302,7 @@ func CombinedProber( &wg, foreignProbeClient, foreignProbeConfiguration.URL, + foreignProbeConfiguration.Host, Foreign, &dataPoints, debugging, @@ -307,6 +314,7 @@ func CombinedProber( &wg, selfDownProbeConnection.Client(), selfProbeConfiguration.URL, + selfProbeConfiguration.Host, SelfDown, &dataPoints, debugging, @@ -318,6 +326,7 @@ func CombinedProber( &wg, selfUpProbeConnection.Client(), selfProbeConfiguration.URL, + selfProbeConfiguration.Host, SelfUp, &dataPoints, debugging, -- cgit v1.2.3