You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.0 KiB
54 lines
1.0 KiB
4 years ago
|
use serde::{
|
||
|
Deserialize,
|
||
|
Serialize
|
||
|
};
|
||
4 years ago
|
use std::{
|
||
|
collections::HashMap
|
||
|
};
|
||
4 years ago
|
use uuid::Uuid;
|
||
4 years ago
|
use crate::{
|
||
|
contracts::*,
|
||
|
UID
|
||
4 years ago
|
};
|
||
|
|
||
4 years ago
|
|
||
|
pub struct UClient {
|
||
|
pub client_info: ClientInfo,
|
||
4 years ago
|
pub jobs: JobPool, // TODO: to futures
|
||
|
pub is_admin: bool,
|
||
4 years ago
|
}
|
||
|
|
||
|
impl UClient {
|
||
|
pub fn new(client_info: ClientInfo) -> Self {
|
||
|
Self {
|
||
|
client_info,
|
||
4 years ago
|
jobs: Vec::new(),
|
||
|
is_admin: false
|
||
4 years ago
|
}
|
||
|
}
|
||
|
}
|
||
4 years ago
|
|
||
4 years ago
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||
4 years ago
|
pub struct ClientInfo {
|
||
|
pub local_ip: String,
|
||
|
pub hostname: String,
|
||
|
pub username: String,
|
||
|
pub os: String,
|
||
|
pub platform: String,
|
||
|
pub id: Uuid,
|
||
|
}
|
||
|
|
||
|
impl ClientInfo {
|
||
|
pub fn gather() -> Self {
|
||
|
ClientInfo {
|
||
|
local_ip: String::from("1.2.3.4"),
|
||
|
hostname: String::from("polokonzerva"),
|
||
4 years ago
|
username: String::from("plazmoid"),
|
||
4 years ago
|
os: String::from("pinux"),
|
||
|
platform: String::from("x86_64"),
|
||
4 years ago
|
id: *UID
|
||
4 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
4 years ago
|
impl ToMsg for ClientInfo {}
|