diff options
| author | Randall Meyer <[email protected]> | 2023-02-15 14:17:00 -0800 |
|---|---|---|
| committer | Randall Meyer <[email protected]> | 2023-02-22 09:18:25 -0800 |
| commit | bfa2e2b0fa93b6059fba0581b52d6d60a53b5a4a (patch) | |
| tree | ff8a9707caf844be368106ee8000ce7c6e0b57db /utilities/utilities.go | |
| parent | aba993ed378297f48ff6be18b17c6a963d3fd190 (diff) | |
new flag: --connect-to
Allows user to override DNS for the initial config request. This is
accomplished using a custom DialContext overring the hostname used to
Dial to. This allows for TLS certificate validation to still
happen(optionally) while connecting to TLS secured resources.
Also,
- allows for optional enforcement of certificate verification
- stamp built git version into binary and adds a --version option
- adds a user-agent to all outgoing request
- exit(1) on failures for easier shell error detection
Diffstat (limited to 'utilities/utilities.go')
| -rw-r--r-- | utilities/utilities.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/utilities/utilities.go b/utilities/utilities.go index 57b4a90..377be56 100644 --- a/utilities/utilities.go +++ b/utilities/utilities.go @@ -28,6 +28,11 @@ import ( "golang.org/x/exp/constraints" ) +var ( + // GitVersion is the Git revision hash + GitVersion = "dev" +) + func Iota(low int, high int) (made []int) { made = make([]int, high-low) @@ -46,9 +51,6 @@ func SignedPercentDifference[T constraints.Float | constraints.Integer]( current T, previous T, ) (difference float64) { - //return ((current - previous) / (float64(current+previous) / 2.0)) * float64( - //100, - // ) fCurrent := float64(current) fPrevious := float64(previous) return ((fCurrent - fPrevious) / fPrevious) * 100.0 @@ -203,3 +205,7 @@ func ApproximatelyEqual[T float32 | float64](truth T, maybe T, fudge T) bool { diff := math.Abs((bTruth - bMaybe)) return diff < bFudge } + +func UserAgent() string { + return fmt.Sprintf("goresponsiveness/%s", GitVersion) +} |
