Can edit more network settings
This commit is contained in:
@ -5,7 +5,7 @@ use crate::controllers::{HttpResult, LibVirtReq};
|
||||
use crate::extractors::local_auth_extractor::LocalAuthEnabled;
|
||||
use crate::libvirt_rest_structures::HypervisorInfo;
|
||||
use actix_web::{HttpResponse, Responder};
|
||||
use sysinfo::{System, SystemExt};
|
||||
use sysinfo::{NetworksExt, System, SystemExt};
|
||||
|
||||
pub async fn root_index() -> impl Responder {
|
||||
HttpResponse::Ok().body("Hello world!")
|
||||
@ -86,3 +86,16 @@ pub async fn server_info(client: LibVirtReq) -> HttpResult {
|
||||
system,
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn networks_list() -> HttpResult {
|
||||
let mut system = System::new();
|
||||
system.refresh_networks_list();
|
||||
|
||||
Ok(HttpResponse::Ok().json(
|
||||
system
|
||||
.networks()
|
||||
.iter()
|
||||
.map(|n| n.0.to_string())
|
||||
.collect::<Vec<_>>(),
|
||||
))
|
||||
}
|
||||
|
Reference in New Issue
Block a user