MarshalJSON implements the json.Marshaler interface for TLSVersion.
()
| 112 | |
| 113 | // MarshalJSON implements the json.Marshaler interface for TLSVersion. |
| 114 | func (tv TLSVersion) MarshalJSON() ([]byte, error) { |
| 115 | for s, v := range TLSVersions { |
| 116 | if tv == v { |
| 117 | return json.Marshal(s) |
| 118 | } |
| 119 | } |
| 120 | return nil, fmt.Errorf("unknown TLS version: %d", tv) |
| 121 | } |
| 122 | |
| 123 | // String implements the fmt.Stringer interface for TLSVersion. |
| 124 | func (tv *TLSVersion) String() string { |
nothing calls this directly
no outgoing calls
no test coverage detected