summaryrefslogtreecommitdiff
path: root/rpm
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2022-12-12 10:02:04 -0500
committerWill Hawkins <[email protected]>2022-12-12 10:02:04 -0500
commit3c59340e315d860f1c39d3d41e808770d0b91697 (patch)
treeb3469bf22d769e1d57b777c57a14c6c9e0a2f4e4 /rpm
parentd0432fdf26e91a6d91534b450112492aabe3a896 (diff)
[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.
Diffstat (limited to 'rpm')
-rw-r--r--rpm/rpm.go11
1 files changed, 10 insertions, 1 deletions
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,