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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct ServerGroup {
pub id: ServerGroupId,
pub name: String,
pub group_type: GroupType,
pub icon: IconId,
pub is_permanent: bool,
pub sort_id: i32,
pub naming_mode: GroupNamingMode,
pub needed_modify_power: i32,
pub needed_member_add_power: i32,
pub needed_member_remove_power: Option<i32>,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct ChannelGroup {
pub id: ChannelGroupId,
pub name: String,
pub group_type: GroupType,
pub icon: IconId,
pub is_permanent: bool,
pub sort_id: i32,
pub naming_mode: GroupNamingMode,
pub needed_modify_power: i32,
pub needed_member_add_power: i32,
pub needed_member_remove_power: Option<i32>,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct OptionalChannelData {
pub channel_id: ChannelId,
pub description: String,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Channel {
pub id: ChannelId,
pub guid: Option<String>,
pub parent: ChannelId,
pub name: String,
pub topic: Option<String>,
pub codec: Codec,
pub codec_quality: Option<u8>,
pub max_clients: Option<MaxClients>,
pub max_family_clients: Option<MaxClients>,
pub order: ChannelId,
pub channel_type: ChannelType,
pub is_default: Option<bool>,
pub has_password: Option<bool>,
pub codec_latency_factor: Option<i32>,
pub is_unencrypted: Option<bool>,
pub delete_delay: Option<Duration>,
pub needed_talk_power: Option<i32>,
pub forced_silence: bool,
pub phonetic_name: Option<String>,
pub icon: Option<IconId>,
pub is_private: Option<bool>,
pub subscribed: bool,
pub permission_hints: Option<ChannelPermissionHint>,
pub optional_data: Option<OptionalChannelData>,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct OptionalClientData {
pub client_id: ClientId,
pub version: String,
pub version_sign: Option<String>,
pub platform: String,
pub login_name: Option<String>,
pub created: OffsetDateTime,
pub last_connected: OffsetDateTime,
pub connections_total: u32,
pub bytes_uploaded_month: u64,
pub bytes_downloaded_month: u64,
pub bytes_uploaded_total: u64,
pub bytes_downloaded_total: u64,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct ConnectionClientData {
pub client_id: ClientId,
pub ping: Option<Duration>,
pub ping_deviation: Option<Duration>,
pub connected_time: Option<Duration>,
pub client_address: Option<SocketAddr>,
pub packets_sent_speech: Option<u64>,
pub packets_sent_keepalive: Option<u64>,
pub packets_sent_control: Option<u64>,
pub bytes_sent_speech: Option<u64>,
pub bytes_sent_keepalive: Option<u64>,
pub bytes_sent_control: Option<u64>,
pub packets_received_speech: Option<u64>,
pub packets_received_keepalive: Option<u64>,
pub packets_received_control: Option<u64>,
pub bytes_received_speech: Option<u64>,
pub bytes_received_keepalive: Option<u64>,
pub bytes_received_control: Option<u64>,
pub server_to_client_packetloss_speech: Option<f32>,
pub server_to_client_packetloss_keepalive: Option<f32>,
pub server_to_client_packetloss_control: Option<f32>,
pub server_to_client_packetloss_total: Option<f32>,
pub client_to_server_packetloss_speech: f32,
pub client_to_server_packetloss_keepalive: f32,
pub client_to_server_packetloss_control: f32,
pub client_to_server_packetloss_total: f32,
pub bandwidth_sent_last_second_speech: Option<u64>,
pub bandwidth_sent_last_second_keepalive: Option<u64>,
pub bandwidth_sent_last_second_control: Option<u64>,
pub bandwidth_sent_last_minute_speech: Option<u64>,
pub bandwidth_sent_last_minute_keepalive: Option<u64>,
pub bandwidth_sent_last_minute_control: Option<u64>,
pub bandwidth_received_last_second_speech: Option<u64>,
pub bandwidth_received_last_second_keepalive: Option<u64>,
pub bandwidth_received_last_second_control: Option<u64>,
pub bandwidth_received_last_minute_speech: Option<u64>,
pub bandwidth_received_last_minute_keepalive: Option<u64>,
pub bandwidth_received_last_minute_control: Option<u64>,
pub filetransfer_bandwidth_sent: Option<u64>,
pub filetransfer_bandwidth_received: Option<u64>,
pub idle_time: Duration,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Client {
pub id: ClientId,
pub channel: ChannelId,
pub uid: Option<UidBuf>,
pub name: String,
pub input_muted: bool,
pub output_muted: bool,
pub output_only_muted: bool,
pub input_hardware_enabled: bool,
pub output_hardware_enabled: bool,
pub talk_power_granted: bool,
pub metadata: String,
pub is_recording: bool,
pub database_id: ClientDbId,
pub channel_group: ChannelGroupId,
pub server_groups: HashSet<ServerGroupId>,
pub away_message: Option<String>,
pub client_type: ClientType,
pub avatar_hash: String,
pub talk_power: i32,
pub talk_power_request: Option<TalkPowerRequest>,
pub description: String,
pub is_priority_speaker: bool,
pub unread_messages: u32,
pub phonetic_name: String,
pub needed_serverquery_view_power: i32,
pub icon: IconId,
pub is_channel_commander: bool,
pub country_code: String,
pub inherited_channel_group_from_channel: ChannelId,
pub badges: String,
pub permission_hints: Option<ClientPermissionHint>,
pub optional_data: Option<OptionalClientData>,
pub connection_data: Option<ConnectionClientData>,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct OptionalServerData {
pub uptime: Duration,
pub has_password: bool,
pub default_channel_admin_group: ChannelGroupId,
pub max_download_bandwidth_total: u64,
pub max_upload_bandwidth_total: u64,
pub complain_autoban_count: u32,
pub complain_autoban_time: Duration,
pub complain_remove_time: Duration,
pub min_clients_in_channel_before_forced_silence: u16,
pub antiflood_points_tick_reduce: u32,
pub antiflood_points_to_command_block: u32,
pub antiflood_points_to_ip_block: u32,
pub antiflood_points_to_plugin_block: u32,
pub connection_count_total: u64,
pub channel_count: u64,
pub client_count: u16,
pub query_count_total: u64,
pub query_count: u32,
pub download_quota: u64,
pub upload_quota: u64,
pub bytes_downloaded_month: u64,
pub bytes_uploaded_month: u64,
pub bytes_downloaded_total: u64,
pub bytes_uploaded_total: u64,
pub port: u16,
pub autostart: bool,
pub machine_id: String,
pub needed_identity_security_level: u8,
pub log_client: bool,
pub log_query: bool,
pub log_channel: bool,
pub log_permissions: bool,
pub log_server: bool,
pub log_filetransfer: bool,
pub min_client_version: OffsetDateTime,
pub reserved_slots: u16,
pub total_packetloss_speech: f32,
pub total_packetloss_keepalive: f32,
pub total_packetloss_control: f32,
pub total_packetloss: f32,
pub total_ping: Duration,
pub weblist_enabled: bool,
pub min_android_version: OffsetDateTime,
pub min_ios_version: OffsetDateTime,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct ConnectionServerData {
pub filetransfer_bandwidth_sent: u64,
pub filetransfer_bandwidth_received: u64,
pub filetransfer_bytes_sent_total: u64,
pub filetransfer_bytes_received_total: u64,
pub packets_sent_total: u64,
pub bytes_sent_total: u64,
pub packets_received_total: u64,
pub bytes_received_total: u64,
pub bandwidth_sent_last_second_total: u64,
pub bandwidth_sent_last_minute_total: u64,
pub bandwidth_received_last_second_total: u64,
pub bandwidth_received_last_minute_total: u64,
pub connected_time: Duration,
pub packetloss_total: f32,
pub ping: Duration,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Server {
pub public_key: EccKeyPubP256,
pub id: u64,
pub name: String,
pub nickname: Option<String>,
pub welcome_message: String,
pub platform: String,
pub version: String,
pub max_clients: u16,
pub created: OffsetDateTime,
pub codec_encryption_mode: CodecEncryptionMode,
pub hostmessage: String,
pub hostmessage_mode: HostMessageMode,
pub default_server_group: ServerGroupId,
pub default_channel_group: ChannelGroupId,
pub hostbanner_url: String,
pub hostbanner_gfx_url: String,
pub hostbanner_gfx_interval: Duration,
pub priority_speaker_dimm_modificator: f32,
pub hostbutton_tooltip: String,
pub hostbutton_url: String,
pub hostbutton_gfx_url: String,
pub phonetic_name: String,
pub icon: IconId,
pub ips: Vec<IpAddr>,
pub ask_for_privilegekey: bool,
pub hostbanner_mode: HostBannerMode,
pub temp_channel_default_delete_delay: Duration,
pub protocol_version: u16,
pub license: LicenseType,
pub optional_data: Option<OptionalServerData>,
pub connection_data: Option<ConnectionServerData>,
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Connection {
pub own_client: ClientId,
pub server: Server,
pub clients: HashMap<ClientId, Client>,
pub channels: HashMap<ChannelId, Channel>,
pub server_groups: HashMap<ServerGroupId, ServerGroup>,
pub channel_groups: HashMap<ChannelGroupId, ChannelGroup>,
}