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