feat: Implement SSH master connector and CLI for certificate management

This commit is contained in:
GW_MC
2026-03-21 03:07:58 +00:00
parent 2fcdc7d0df
commit 1a453a7e5c
8 changed files with 687 additions and 3 deletions

View File

@@ -0,0 +1,40 @@
use std::sync::Arc;
use tokio::sync::Mutex;
pub mod ssh;
pub type AgentClient = nxmesh_proto::agent_service_client::AgentServiceClient<tonic::transport::Channel>;
#[async_trait::async_trait]
pub trait MasterConnectorTrait: Send + Sync {
async fn connect(
&mut self,
settings: &crate::config::settings::Settings,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>>;
fn get_client(&self) -> Arc<Mutex<AgentClient>>;
}
pub struct MasterConnector {
connector: Box<dyn MasterConnectorTrait>,
}
impl MasterConnector {
pub fn new(connector: Box<dyn MasterConnectorTrait>) -> Self {
Self { connector }
}
}
#[async_trait::async_trait]
impl MasterConnectorTrait for MasterConnector {
async fn connect(
&mut self,
settings: &crate::config::settings::Settings,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
self.connector.connect(settings).await
}
fn get_client(&self) -> Arc<Mutex<AgentClient>> {
self.connector.get_client()
}
}