-
Notifications
You must be signed in to change notification settings - Fork 258
/
Copy pathchannelling.go
273 lines (236 loc) · 6.14 KB
/
channelling.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*
* Spreed WebRTC.
* Copyright (C) 2013-2015 struktur AG
*
* This file is part of Spreed WebRTC.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package main
type DataError struct {
Type string
Code string
Message string
}
func NewDataError(code, message string) error {
return &DataError{"Error", code, message}
}
func (err *DataError) Error() string {
return err.Message
}
type DataRoomCredentials struct {
PIN string
}
type DataHello struct {
Version string
Ua string
Id string // Compatibility with old clients.
Name string // Room name.
Type string // Room type.
Credentials *DataRoomCredentials
}
type DataWelcome struct {
Type string
Room *DataRoom
Users []*DataSession
}
type DataRoom struct {
Type string // Room type.
Name string // Room name.
Credentials *DataRoomCredentials
}
type DataOffer struct {
Type string
To string
Offer interface{}
}
type DataCandidate struct {
Type string
To string
Candidate interface{}
}
type DataAnswer struct {
Type string
To string
Answer interface{}
}
type DataSelf struct {
Type string
Id string
Sid string
Userid string
Suserid string
Token string
Version string // Server version.
ApiVersion float64 // Server channelling API version.
Turn *DataTurn
Stun []string
}
type DataTurn struct {
Username string `json:"username"`
Password string `json:"password"`
Ttl int `json:"ttl"`
Urls []string `json:"urls"`
}
type DataSession struct {
Type string
Id string
Userid string `json:",omitempty"`
Ua string `json:",omitempty"`
Token string `json:",omitempty"`
Version string `json:",omitempty"`
Rev uint64 `json:",omitempty"`
Prio int `json:",omitempty"`
Status interface{} `json:",omitempty"`
stamp int64
}
type DataUser struct {
Id string
Sessions int
}
type DataBye struct {
Type string
To string
Bye interface{}
}
type DataStatus struct {
Type string
Status interface{}
}
type DataChat struct {
To string
Type string
Chat *DataChatMessage
}
type DataChatMessage struct {
Message string
Time string
NoEcho bool `json:",omitempty"`
Mid string `json:",omitempty"`
Status *DataChatStatus
}
type DataChatStatus struct {
Typing string `json:",omitempty"`
State string `json:",omitempty"`
Mid string `json:",omitempty"`
SeenMids []string `json:",omitempty"`
FileInfo *DataFileInfo `json:",omitempty"`
Geolocation *DataGeolocation `json:",omitempty"`
ContactRequest *DataContactRequest `json:",omitempty"`
AutoCall *DataAutoCall `json:",omitempty"`
}
type DataFileInfo struct {
Id string `json:"id"`
Chunks uint64 `json:"chunks"`
Name string `json:"name"`
Size uint64 `json:"size"`
Type string `json:"type"`
}
type DataGeolocation struct {
Accuracy float64 `json:"accuracy,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
Longitude float64 `json:"longitude,omitempty"`
Altitude float64 `json:"altitude,omitempty"`
AltitudeAccuracy float64 `json:"altitudeAccuracy,omitempty"`
}
type DataContactRequest struct {
Id string
Success bool
Userid string `json:",omitempty"`
Token string `json:",omitempty"`
}
type DataAutoCall struct {
Id string
Type string
}
type DataIncoming struct {
Type string
Hello *DataHello
Offer *DataOffer
Candidate *DataCandidate
Answer *DataAnswer
Bye *DataBye
Status *DataStatus
Chat *DataChat
Conference *DataConference
Alive *DataAlive
Authentication *DataAuthentication
Sessions *DataSessions
Room *DataRoom
Iid string `json:",omitempty"`
EncryptionRegister *DataEncryptionRegister
EncryptionRequestKeyBundle *DataEncryptionRequestKeyBundle
EncryptionKeyBundle *DataEncryptionKeyBundle
Encrypted *DataEncrypted
}
type DataOutgoing struct {
Data interface{}
From string
To string
Iid string `json:",omitempty"`
A string `json:",omitempty"`
}
type DataSessions struct {
Type string
Sessions *DataSessionsRequest `json:",omitempty"`
Users []*DataSession
}
type DataSessionsRequest struct {
Token string
Type string
}
type DataConference struct {
Id string
Type string
Conference []string
}
type DataAlive struct {
Type string
Alive uint64
}
type DataAuthentication struct {
Type string
Authentication *SessionToken
}
type DataEncryptionRegisterSignedPreKey struct {
Id int64
Key string
Signature string
}
type DataEncryptionRegister struct {
RegistrationId int64
Identity string
LastResortSignedPreKey DataEncryptionRegisterSignedPreKey
}
type DataEncryptionRequestKeyBundle struct {
To string `json:",omitempty"`
Type string `json:",omitempty"`
}
type DataEncryptionKeyBundle struct {
To string `json:",omitempty"`
Type string `json:",omitempty"`
Identity string
PreKeyId int64 `json:",omitempty"`
PreKey string `json:",omitempty"`
SignedPreKeyId int64 `json:",omitempty"`
SignedPreKey string `json:",omitempty"`
SignedPreKeySignature string `json:",omitempty"`
}
type DataEncrypted struct {
To string `json:",omitempty"`
Type string `json:",omitempty"`
Message string
Data string
}