mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-09 16:11:31 +00:00
feat: fast guest lookup table and host identification
This commit is contained in:
22
crates/ctl/src/cli/identify_host.rs
Normal file
22
crates/ctl/src/cli/identify_host.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use krata::v1::control::{control_service_client::ControlServiceClient, IdentifyHostRequest};
|
||||
|
||||
use tonic::{transport::Channel, Request};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(about = "Identify information about the host")]
|
||||
pub struct IdentifyHostCommand {}
|
||||
|
||||
impl IdentifyHostCommand {
|
||||
pub async fn run(self, mut client: ControlServiceClient<Channel>) -> Result<()> {
|
||||
let response = client
|
||||
.identify_host(Request::new(IdentifyHostRequest {}))
|
||||
.await?
|
||||
.into_inner();
|
||||
println!("Host UUID: {}", response.host_uuid);
|
||||
println!("Host Domain: {}", response.host_domid);
|
||||
println!("Krata Version: {}", response.krata_version);
|
||||
Ok(())
|
||||
}
|
||||
}
|
@ -83,8 +83,8 @@ impl IdmSnoopCommand {
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct IdmSnoopLine {
|
||||
pub from: u32,
|
||||
pub to: u32,
|
||||
pub from: String,
|
||||
pub to: String,
|
||||
pub packet: IdmSnoopData,
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
pub mod attach;
|
||||
pub mod destroy;
|
||||
pub mod identify_host;
|
||||
pub mod idm_snoop;
|
||||
pub mod launch;
|
||||
pub mod list;
|
||||
@ -20,9 +21,10 @@ use krata::{
|
||||
use tonic::{transport::Channel, Request};
|
||||
|
||||
use self::{
|
||||
attach::AttachCommand, destroy::DestroyCommand, idm_snoop::IdmSnoopCommand,
|
||||
launch::LauchCommand, list::ListCommand, logs::LogsCommand, metrics::MetricsCommand,
|
||||
pull::PullCommand, resolve::ResolveCommand, top::TopCommand, watch::WatchCommand,
|
||||
attach::AttachCommand, destroy::DestroyCommand, identify_host::IdentifyHostCommand,
|
||||
idm_snoop::IdmSnoopCommand, launch::LauchCommand, list::ListCommand, logs::LogsCommand,
|
||||
metrics::MetricsCommand, pull::PullCommand, resolve::ResolveCommand, top::TopCommand,
|
||||
watch::WatchCommand,
|
||||
};
|
||||
|
||||
#[derive(Parser)]
|
||||
@ -56,6 +58,7 @@ pub enum Commands {
|
||||
Metrics(MetricsCommand),
|
||||
IdmSnoop(IdmSnoopCommand),
|
||||
Top(TopCommand),
|
||||
IdentifyHost(IdentifyHostCommand),
|
||||
}
|
||||
|
||||
impl ControlCommand {
|
||||
@ -107,6 +110,10 @@ impl ControlCommand {
|
||||
Commands::Pull(pull) => {
|
||||
pull.run(client).await?;
|
||||
}
|
||||
|
||||
Commands::IdentifyHost(identify) => {
|
||||
identify.run(client).await?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user