diff --git a/config/http_config.go b/config/http_config.go index 88457375..c2116b7e 100644 --- a/config/http_config.go +++ b/config/http_config.go @@ -132,7 +132,7 @@ func (tv *TLSVersion) String() string { return s } } - return fmt.Sprintf("%d", tv) + return fmt.Sprintf("%d", *tv) } // BasicAuth contains basic HTTP authentication credentials. diff --git a/config/tls_config_test.go b/config/tls_config_test.go index f02c87fd..cffe1320 100644 --- a/config/tls_config_test.go +++ b/config/tls_config_test.go @@ -137,6 +137,13 @@ func TestTLSVersionStringer(t *testing.T) { require.Equalf(t, "TLS13", s.String(), "tls.VersionTLS13 string should be TLS13, got %s", s.String()) } +func TestTLSVersionStringerUnknown(t *testing.T) { + // An unknown TLS version (not present in TLSVersions) must fall back to its + // numeric value, not to the pointer address. + s := TLSVersion(0x9999) // 39321 + require.Equal(t, "39321", s.String()) +} + func TestTLSVersionMarshalYAML(t *testing.T) { tests := []struct { input TLSVersion