mediamtx/internal/conf/webrtc_ice_server.go
Alessandro Ros 575d3585fe
fix unexpected behavior of authInternalUsers or authHTTPExclude (#3316)
when some subfields of authInternalUsers or authHTTPExclude were not
set explicitly in the configuration file, default values were used in
their place. This is caused by a strange behavior of Go
(https://github.com/golang/go/issues/21092)
2024-05-04 10:12:43 +02:00

23 lines
613 B
Go

package conf
import "encoding/json"
// WebRTCICEServer is a WebRTC ICE Server.
type WebRTCICEServer struct {
URL string `json:"url"`
Username string `json:"username"`
Password string `json:"password"`
ClientOnly bool `json:"clientOnly"`
}
// WebRTCICEServers is a list of WebRTCICEServer
type WebRTCICEServers []WebRTCICEServer
// UnmarshalJSON implements json.Unmarshaler.
func (s *WebRTCICEServers) UnmarshalJSON(b []byte) error {
// remove default value before loading new value
// https://github.com/golang/go/issues/21092
*s = nil
return json.Unmarshal(b, (*[]WebRTCICEServer)(s))
}