feat: wire shared nic into instance setup

Route normal, DHCP, and mobile nic creation through one helper that
selects the shared backend when dev_name is configured.

Keep dedicated nic creation as the default for configs without a
dev_name, and keep no_tun handling in the existing callers.

Store a process-wide shared virtual nic registry behind each instance
so networks with the same dev_name attach to the same shared device.
This commit is contained in:
sijie.sun
2026-06-14 01:26:19 +08:00
parent 62e43855cb
commit 47a2fb19a6
2 changed files with 96 additions and 6 deletions
+2
View File
@@ -121,6 +121,7 @@ impl EasyTierLauncher {
let peer_mgr = instance.get_peer_manager();
let nic_ctx = instance.get_nic_ctx();
let peer_packet_receiver = instance.get_peer_packet_receiver();
let shared_virtual_nic_registry = instance.get_shared_virtual_nic_registry();
let mut tun_fd_receiver = data.tun_fd.1.lock().unwrap().take().unwrap();
tasks.spawn(async move {
@@ -133,6 +134,7 @@ impl EasyTierLauncher {
global_ctx.clone(),
peer_mgr.clone(),
peer_packet_receiver.clone(),
shared_virtual_nic_registry.clone(),
tun_fd,
)
.await;