Configurable capture backend (#150)

capture backend can now be configured via the `capture_backend` cli argument / config entry
This commit is contained in:
Ferdinand Schober
2024-06-29 00:10:36 +02:00
committed by GitHub
parent 232c048c19
commit 3528ef4fae
15 changed files with 278 additions and 93 deletions

View File

@@ -8,7 +8,7 @@ use tokio::signal;
use crate::{
client::{ClientConfig, ClientHandle, ClientManager, ClientState},
config::Config,
config::{CaptureBackend, Config},
dns,
frontend::{FrontendListener, FrontendRequest},
server::capture_task::CaptureEvent,
@@ -77,7 +77,7 @@ impl Server {
}
}
pub async fn run(&self) -> anyhow::Result<()> {
pub async fn run(&self, backend: Option<CaptureBackend>) -> anyhow::Result<()> {
// create frontend communication adapter
let frontend = match FrontendListener::new().await {
Some(f) => f?,
@@ -97,11 +97,12 @@ impl Server {
// input capture
let (mut capture_task, capture_channel) = capture_task::new(
backend,
self.clone(),
sender_tx.clone(),
timer_tx.clone(),
self.release_bind.clone(),
);
)?;
// input emulation
let (mut emulation_task, emulate_channel) = emulation_task::new(