Implement IP sink interface

This commit is contained in:
Aram 🍐 2021-10-16 19:38:47 -04:00
parent cfdbdc8f51
commit 2bcb9e714b
4 changed files with 82 additions and 6 deletions

View file

@ -18,6 +18,7 @@ use crate::virtual_device::VirtualIpDevice;
use crate::wg::WireGuardTunnel;
pub mod config;
pub mod ip_sink;
pub mod port_pool;
pub mod virtual_device;
pub mod wg;
@ -47,6 +48,12 @@ async fn main() -> anyhow::Result<()> {
tokio::spawn(async move { wg.consume_task().await });
}
{
// Start IP sink task for incoming IP packets
let wg = wg.clone();
tokio::spawn(async move { ip_sink::run_ip_sink_interface(wg).await });
}
info!(
"Tunnelling [{}]->[{}] (via [{}] as peer {})",
&config.source_addr, &config.dest_addr, &config.endpoint_addr, &config.source_peer_ip
@ -278,7 +285,6 @@ async fn virtual_tcp_interface(
IpCidr::new(IpAddress::from(source_peer_ip), 32),
IpCidr::new(IpAddress::from(dest_addr.ip()), 32),
])
.any_ip(true)
.finalize();
// Server socket: this is a placeholder for the interface to route new connections to.