harmony/harmony-rs/opnsense-config/src/lib.rs

46 lines
1.1 KiB
Rust

pub mod config;
pub mod error;
pub mod modules;
pub use config::Config;
pub use error::Error;
#[cfg(test)]
mod test {
use config::SshConfigRepository;
use russh::client;
use std::{net::Ipv4Addr, sync::Arc, time::Duration};
use crate::{
config::{self, SshCredentials},
Config,
};
#[tokio::test]
async fn test_public_sdk() {
let config = Arc::new(client::Config {
inactivity_timeout: Some(Duration::from_secs(5)),
..<_>::default()
});
let credentials = SshCredentials::Password {
username: String::from("root"),
password: String::from("opnsense"),
};
let repo =
SshConfigRepository::new((Ipv4Addr::new(192, 168, 5, 229), 22), credentials, config);
let mut config = Config::new(Box::new(repo)).await.unwrap();
config
.dhcp()
.add_static_mapping(
"test_mac",
Ipv4Addr::new(192, 168, 168, 168),
"test_hostname",
)
.unwrap();
todo!();
// opnsense.apply_changes().await;
}
}