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