fix wifi types

This commit is contained in:
Aiden McClelland
2024-04-09 15:24:05 -06:00
parent 2bc64920dd
commit e9166c4a7d
12 changed files with 85 additions and 72 deletions

View File

@@ -91,8 +91,6 @@ impl ClientConfig {
pub struct ServerConfig {
#[arg(short = 'c', long = "config")]
pub config: Option<PathBuf>,
#[arg(long = "wifi-interface")]
pub wifi_interface: Option<String>,
#[arg(long = "ethernet-interface")]
pub ethernet_interface: Option<String>,
#[arg(skip)]
@@ -117,7 +115,6 @@ impl ContextConfig for ServerConfig {
self.config.take()
}
fn merge_with(&mut self, other: Self) {
self.wifi_interface = self.wifi_interface.take().or(other.wifi_interface);
self.ethernet_interface = self.ethernet_interface.take().or(other.ethernet_interface);
self.os_partitions = self.os_partitions.take().or(other.os_partitions);
self.bind_rpc = self.bind_rpc.take().or(other.bind_rpc);

View File

@@ -26,7 +26,7 @@ use crate::init::check_time_is_synchronized;
use crate::lxc::{LxcContainer, LxcManager};
use crate::middleware::auth::HashSessionToken;
use crate::net::net_controller::NetController;
use crate::net::utils::find_eth_iface;
use crate::net::utils::{find_eth_iface, find_wifi_iface};
use crate::net::wifi::WpaCli;
use crate::prelude::*;
use crate::service::ServiceMap;
@@ -132,6 +132,8 @@ impl RpcContext {
});
}
let wifi_interface = find_wifi_iface().await?;
let seed = Arc::new(RpcContextSeed {
is_closed: AtomicBool::new(false),
datadir: config.datadir().to_path_buf(),
@@ -141,7 +143,7 @@ impl RpcContext {
ErrorKind::Filesystem,
)
})?,
wifi_interface: config.wifi_interface.clone(),
wifi_interface: wifi_interface.clone(),
ethernet_interface: if let Some(eth) = config.ethernet_interface.clone() {
eth
} else {
@@ -158,8 +160,7 @@ impl RpcContext {
lxc_manager: Arc::new(LxcManager::new()),
open_authed_websockets: Mutex::new(BTreeMap::new()),
rpc_stream_continuations: Mutex::new(BTreeMap::new()),
wifi_manager: config
.wifi_interface
wifi_manager: wifi_interface
.clone()
.map(|i| Arc::new(RwLock::new(WpaCli::init(i)))),
current_secret: Arc::new(