mirror of
https://github.com/aramperes/onetun.git
synced 2025-09-09 17:38:32 -04:00
Checkpoint
This commit is contained in:
parent
fb50ee7113
commit
282d4f48eb
4 changed files with 81 additions and 7 deletions
|
@ -90,7 +90,7 @@ impl WireGuardTunnel {
|
|||
virtual_port: VirtualPort,
|
||||
sender: tokio::sync::mpsc::Sender<Vec<u8>>,
|
||||
) -> anyhow::Result<()> {
|
||||
let existing = self.virtual_port_ip_tx.contains_key(&virtual_port);
|
||||
let existing = self.is_registered(virtual_port);
|
||||
if existing {
|
||||
Err(anyhow::anyhow!("Cannot register virtual interface with virtual port {} because it is already registered", virtual_port))
|
||||
} else {
|
||||
|
@ -99,6 +99,10 @@ impl WireGuardTunnel {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_registered(&self, virtual_port: VirtualPort) -> bool {
|
||||
self.virtual_port_ip_tx.contains_key(&virtual_port)
|
||||
}
|
||||
|
||||
/// Register a virtual interface (using its assigned virtual port) with the given IP packet `Sender`.
|
||||
pub async fn register_sink_interface(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue