Introduce a new module and interface for serving files via TFTP in the HAClusterTopology structure. This includes adding the necessary dependencies, creating the `TftpServer` trait, implementing it where appropriate, and integrating its usage within the topology struct. Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/10 Co-authored-by: Jean-Gabriel Gill-Couture <jg@nationtech.io> Co-committed-by: Jean-Gabriel Gill-Couture <jg@nationtech.io>
32 lines
980 B
Rust
32 lines
980 B
Rust
mod ssh;
|
|
pub use ssh::*;
|
|
|
|
use async_trait::async_trait;
|
|
|
|
use crate::Error;
|
|
|
|
#[async_trait]
|
|
pub trait OPNsenseShell: std::fmt::Debug + Send + Sync {
|
|
async fn exec(&self, command: &str) -> Result<String, Error>;
|
|
async fn write_content_to_temp_file(&self, content: &str) -> Result<String, Error>;
|
|
async fn upload_folder(&self, source: &str, destination: &str) -> Result<String, Error>;
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[derive(Debug)]
|
|
pub struct DummyOPNSenseShell;
|
|
|
|
#[cfg(test)]
|
|
#[async_trait]
|
|
impl OPNsenseShell for DummyOPNSenseShell {
|
|
async fn exec(&self, _command: &str) -> Result<String, Error> {
|
|
unimplemented!("This is a dummy implementation");
|
|
}
|
|
async fn write_content_to_temp_file(&self, _content: &str) -> Result<String, Error> {
|
|
unimplemented!("This is a dummy implementation");
|
|
}
|
|
async fn upload_folder(&self, _source: &str, _destination: &str) -> Result<String, Error> {
|
|
unimplemented!("This is a dummy implementation");
|
|
}
|
|
}
|