mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Co-authored-by: Jason Quigley <jason@onecha.net>
This commit is contained in:
parent
57e3622b85
commit
abf71649b0
1 changed files with 1 additions and 1 deletions
|
@ -52,6 +52,7 @@ func RequestTurnServer(req *http.Request, device *api.Device, cfg *config.Client
|
||||||
|
|
||||||
if turnConfig.SharedSecret != "" {
|
if turnConfig.SharedSecret != "" {
|
||||||
expiry := time.Now().Add(duration).Unix()
|
expiry := time.Now().Add(duration).Unix()
|
||||||
|
resp.Username = fmt.Sprintf("%d:%s", expiry, device.UserID)
|
||||||
mac := hmac.New(sha1.New, []byte(turnConfig.SharedSecret))
|
mac := hmac.New(sha1.New, []byte(turnConfig.SharedSecret))
|
||||||
_, err := mac.Write([]byte(resp.Username))
|
_, err := mac.Write([]byte(resp.Username))
|
||||||
|
|
||||||
|
@ -60,7 +61,6 @@ func RequestTurnServer(req *http.Request, device *api.Device, cfg *config.Client
|
||||||
return jsonerror.InternalServerError()
|
return jsonerror.InternalServerError()
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.Username = fmt.Sprintf("%d:%s", expiry, device.UserID)
|
|
||||||
resp.Password = base64.StdEncoding.EncodeToString(mac.Sum(nil))
|
resp.Password = base64.StdEncoding.EncodeToString(mac.Sum(nil))
|
||||||
} else if turnConfig.Username != "" && turnConfig.Password != "" {
|
} else if turnConfig.Username != "" && turnConfig.Password != "" {
|
||||||
resp.Username = turnConfig.Username
|
resp.Username = turnConfig.Username
|
||||||
|
|
Loading…
Reference in a new issue