github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/model/webrtc.go (about)

     1  // Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"encoding/json"
     8  	"io"
     9  )
    10  
    11  type WebrtcInfoResponse struct {
    12  	Token        string `json:"token"`
    13  	GatewayUrl   string `json:"gateway_url"`
    14  	StunUri      string `json:"stun_uri,omitempty"`
    15  	TurnUri      string `json:"turn_uri,omitempty"`
    16  	TurnPassword string `json:"turn_password,omitempty"`
    17  	TurnUsername string `json:"turn_username,omitempty"`
    18  }
    19  
    20  type GatewayResponse struct {
    21  	Status string `json:"janus"`
    22  }
    23  
    24  func GatewayResponseFromJson(data io.Reader) *GatewayResponse {
    25  	var o *GatewayResponse
    26  	json.NewDecoder(data).Decode(&o)
    27  	return o
    28  }
    29  
    30  func (o *WebrtcInfoResponse) ToJson() string {
    31  	b, _ := json.Marshal(o)
    32  	return string(b)
    33  }
    34  
    35  func WebrtcInfoResponseFromJson(data io.Reader) *WebrtcInfoResponse {
    36  	var o *WebrtcInfoResponse
    37  	json.NewDecoder(data).Decode(&o)
    38  	return o
    39  }