MarshalJSON implements the json.Unmarshaler interface for TLSVersion.
(data []byte)
| 92 | |
| 93 | // MarshalJSON implements the json.Unmarshaler interface for TLSVersion. |
| 94 | func (tv *TLSVersion) UnmarshalJSON(data []byte) error { |
| 95 | var s string |
| 96 | if err := json.Unmarshal(data, &s); err != nil { |
| 97 | return err |
| 98 | } |
| 99 | if v, ok := TLSVersions[s]; ok { |
| 100 | *tv = v |
| 101 | return nil |
| 102 | } |
| 103 | return fmt.Errorf("unknown TLS version: %s", s) |
| 104 | } |
| 105 | |
| 106 | // MarshalJSON implements the json.Marshaler interface for TLSVersion. |
| 107 | func (tv TLSVersion) MarshalJSON() ([]byte, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected