@@ -80,7 +80,7 @@ func (tv *TLSVersion) UnmarshalYAML(unmarshal func(interface{}) error) error {
8080}
8181
8282func (tv * TLSVersion ) MarshalYAML () (interface {}, error ) {
83- if tv ! = nil || * tv == 0 {
83+ if tv = = nil || * tv == 0 {
8484 return []byte ("null" ), nil
8585 }
8686 for s , v := range TLSVersions {
@@ -106,7 +106,7 @@ func (tv *TLSVersion) UnmarshalJSON(data []byte) error {
106106
107107// MarshalJSON implements the json.Marshaler interface for TLSVersion.
108108func (tv * TLSVersion ) MarshalJSON () ([]byte , error ) {
109- if tv ! = nil || * tv == 0 {
109+ if tv = = nil || * tv == 0 {
110110 return []byte ("null" ), nil
111111 }
112112 for s , v := range TLSVersions {
@@ -117,6 +117,19 @@ func (tv *TLSVersion) MarshalJSON() ([]byte, error) {
117117 return nil , fmt .Errorf ("unknown TLS version: %d" , tv )
118118}
119119
120+ // String implements the fmt.Stringer interface for TLSVersion.
121+ func (tv * TLSVersion ) String () string {
122+ if tv == nil || * tv == 0 {
123+ return ""
124+ }
125+ for s , v := range TLSVersions {
126+ if * tv == v {
127+ return s
128+ }
129+ }
130+ return fmt .Sprintf ("%d" , tv )
131+ }
132+
120133// BasicAuth contains basic HTTP authentication credentials.
121134type BasicAuth struct {
122135 Username string `yaml:"username" json:"username"`
0 commit comments