diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-01-13 15:17:50 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-01-13 15:17:50 -0500 |
commit | 0e2b321e6f5ab5983bc3428aa455dac7012c36ee (patch) | |
tree | c3919a284cf13ddcb66a6f482b1c9bbd9f34fc9b /app/webtrc.go | |
parent | 97558f6a6ec4c53fa69035fb430ead209d9c222d (diff) | |
download | chat-0e2b321e6f5ab5983bc3428aa455dac7012c36ee.tar.gz chat-0e2b321e6f5ab5983bc3428aa455dac7012c36ee.tar.bz2 chat-0e2b321e6f5ab5983bc3428aa455dac7012c36ee.zip |
Refactor and migrate more functions out of api into app package (#5063)
Diffstat (limited to 'app/webtrc.go')
-rw-r--r-- | app/webtrc.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app/webtrc.go b/app/webtrc.go new file mode 100644 index 000000000..b526c96a6 --- /dev/null +++ b/app/webtrc.go @@ -0,0 +1,33 @@ +// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package app + +import ( + "crypto/tls" + "encoding/base64" + "net/http" + "strings" + + "github.com/mattermost/platform/model" + "github.com/mattermost/platform/utils" +) + +func RevokeWebrtcToken(sessionId string) { + token := base64.StdEncoding.EncodeToString([]byte(sessionId)) + data := make(map[string]string) + data["janus"] = "remove_token" + data["token"] = token + data["transaction"] = model.NewId() + data["admin_secret"] = *utils.Cfg.WebrtcSettings.GatewayAdminSecret + + rq, _ := http.NewRequest("POST", *utils.Cfg.WebrtcSettings.GatewayAdminUrl, strings.NewReader(model.MapToJson(data))) + rq.Header.Set("Content-Type", "application/json") + + // we do not care about the response + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: *utils.Cfg.ServiceSettings.EnableInsecureOutgoingConnections}, + } + httpClient := &http.Client{Transport: tr} + httpClient.Do(rq) +} |