mirror of
https://github.com/aramperes/onetun.git
synced 2025-09-10 06:34:03 -04:00
Add optional IP packet capture for WireGuard tunnel
This commit is contained in:
parent
953bc18279
commit
ff0f5b967e
5 changed files with 141 additions and 1 deletions
|
@ -17,6 +17,7 @@ use crate::wg::WireGuardTunnel;
|
|||
|
||||
pub mod config;
|
||||
pub mod events;
|
||||
pub mod pcap;
|
||||
pub mod tunnel;
|
||||
pub mod virtual_device;
|
||||
pub mod virtual_iface;
|
||||
|
@ -37,6 +38,12 @@ async fn main() -> anyhow::Result<()> {
|
|||
|
||||
let bus = Bus::default();
|
||||
|
||||
if let Some(pcap_file) = config.pcap_file.clone() {
|
||||
// Start packet capture
|
||||
let bus = bus.clone();
|
||||
tokio::spawn(async move { pcap::capture(pcap_file, bus).await });
|
||||
}
|
||||
|
||||
let wg = WireGuardTunnel::new(&config, bus.clone())
|
||||
.await
|
||||
.with_context(|| "Failed to initialize WireGuard tunnel")?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue