✨ encrypted msg + online reporting + refactor
This commit is contained in:
parent
125d50530d
commit
a567214f58
19 changed files with 318 additions and 304 deletions
24
src/herd_core/model.rs
Normal file
24
src/herd_core/model.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use crate::api;
|
||||
use crate::generate_token;
|
||||
use owl::prelude::*;
|
||||
|
||||
#[model]
|
||||
pub struct Machine {
|
||||
pub id: Id,
|
||||
pub hostname: String,
|
||||
pub token: String,
|
||||
pub identity: (String, String),
|
||||
pub next_token: Option<String>,
|
||||
}
|
||||
|
||||
impl Machine {
|
||||
pub fn from_join_param(join: api::JoinParams) -> Self {
|
||||
Self {
|
||||
id: Id::String(join.machine_id.trim().to_string()),
|
||||
hostname: join.hostname.trim().to_string(),
|
||||
identity: join.identity,
|
||||
token: generate_token(),
|
||||
next_token: None,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue