Validate TURN config to guard against invalid values (#4742)
This commit is contained in:
@@ -1096,11 +1096,14 @@ func (r *RoomManager) iceServersForParticipant(apiKey string, participant types.
|
||||
|
||||
var username, credential string
|
||||
if s.Secret != "" {
|
||||
// Generate dynamic credentials using TURN static auth secrets
|
||||
// Generate dynamic credentials using TURN static auth secrets.
|
||||
// 0 means use the default; clamp the rest so a negative or overflowing TTL
|
||||
// cannot produce a wrong-lifetime credential.
|
||||
ttl := s.TTL
|
||||
if ttl == 0 {
|
||||
ttl = 14400 // Default 4 hours
|
||||
ttl = config.DefaultExternalTURNTTLSeconds
|
||||
}
|
||||
ttl, _ = config.ClampTURNTTLSeconds(ttl)
|
||||
|
||||
expiry := time.Now().Add(time.Duration(ttl) * time.Second).Unix()
|
||||
participantID := string(participant.ID())
|
||||
|
||||
Reference in New Issue
Block a user