MCPcopy Create free account
hub / github.com/prometheus/common / UnmarshalJSON

Method UnmarshalJSON

config/http_config.go:94–104  ·  view source on GitHub ↗

MarshalJSON implements the json.Unmarshaler interface for TLSVersion.

(data []byte)

Source from the content-addressed store, hash-verified

92
93// MarshalJSON implements the json.Unmarshaler interface for TLSVersion.
94func (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.
107func (tv TLSVersion) MarshalJSON() ([]byte, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected