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

Method UnmarshalJSON

config/http_config.go:101–111  ·  view source on GitHub ↗

MarshalJSON implements the json.Unmarshaler interface for TLSVersion.

(data []byte)

Source from the content-addressed store, hash-verified

99
100// MarshalJSON implements the json.Unmarshaler interface for TLSVersion.
101func (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.
114func (tv TLSVersion) MarshalJSON() ([]byte, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected