use voip turnServers struct from gomatrix for dedup and consistency (#344)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>main
parent
8599a36fa6
commit
bb8dcb09a1
|
@ -26,16 +26,10 @@ import (
|
||||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||||
"github.com/matrix-org/dendrite/clientapi/httputil"
|
"github.com/matrix-org/dendrite/clientapi/httputil"
|
||||||
"github.com/matrix-org/dendrite/common/config"
|
"github.com/matrix-org/dendrite/common/config"
|
||||||
|
"github.com/matrix-org/gomatrix"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type turnServerResponse struct {
|
|
||||||
Username string `json:"username"`
|
|
||||||
Password string `json:"password"`
|
|
||||||
URIs []string `json:"uris"`
|
|
||||||
TTL int `json:"ttl"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// RequestTurnServer implements:
|
// RequestTurnServer implements:
|
||||||
// GET /voip/turnServer
|
// GET /voip/turnServer
|
||||||
func RequestTurnServer(req *http.Request, device *authtypes.Device, cfg config.Dendrite) util.JSONResponse {
|
func RequestTurnServer(req *http.Request, device *authtypes.Device, cfg config.Dendrite) util.JSONResponse {
|
||||||
|
@ -52,7 +46,7 @@ func RequestTurnServer(req *http.Request, device *authtypes.Device, cfg config.D
|
||||||
// Duration checked at startup, err not possible
|
// Duration checked at startup, err not possible
|
||||||
duration, _ := time.ParseDuration(turnConfig.UserLifetime)
|
duration, _ := time.ParseDuration(turnConfig.UserLifetime)
|
||||||
|
|
||||||
resp := turnServerResponse{
|
resp := gomatrix.RespTurnServer{
|
||||||
URIs: turnConfig.URIs,
|
URIs: turnConfig.URIs,
|
||||||
TTL: int(duration.Seconds()),
|
TTL: int(duration.Seconds()),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue