mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-21 12:10:55 +03:00
refactor error types
This commit is contained in:
@@ -8,7 +8,7 @@ use tokio::signal;
|
||||
|
||||
use crate::{
|
||||
client::{ClientConfig, ClientHandle, ClientManager, ClientState},
|
||||
config::{CaptureBackend, Config},
|
||||
config::{CaptureBackend, Config, EmulationBackend},
|
||||
dns,
|
||||
frontend::{FrontendListener, FrontendRequest},
|
||||
server::capture_task::CaptureEvent,
|
||||
@@ -77,7 +77,11 @@ impl Server {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn run(&self, backend: Option<CaptureBackend>) -> anyhow::Result<()> {
|
||||
pub async fn run(
|
||||
&self,
|
||||
capture_backend: Option<CaptureBackend>,
|
||||
emulation_backend: Option<EmulationBackend>,
|
||||
) -> anyhow::Result<()> {
|
||||
// create frontend communication adapter
|
||||
let frontend = match FrontendListener::new().await {
|
||||
Some(f) => f?,
|
||||
@@ -97,7 +101,7 @@ impl Server {
|
||||
|
||||
// input capture
|
||||
let (mut capture_task, capture_channel) = capture_task::new(
|
||||
backend,
|
||||
capture_backend,
|
||||
self.clone(),
|
||||
sender_tx.clone(),
|
||||
timer_tx.clone(),
|
||||
@@ -106,12 +110,13 @@ impl Server {
|
||||
|
||||
// input emulation
|
||||
let (mut emulation_task, emulate_channel) = emulation_task::new(
|
||||
emulation_backend,
|
||||
self.clone(),
|
||||
receiver_rx,
|
||||
sender_tx.clone(),
|
||||
capture_channel.clone(),
|
||||
timer_tx,
|
||||
);
|
||||
)?;
|
||||
|
||||
// create dns resolver
|
||||
let resolver = dns::DnsResolver::new().await?;
|
||||
|
||||
Reference in New Issue
Block a user