start tcp proxy after tun device created (#94)

on win 10, tcp proxy listener created before tun device may not accept
conn from tun dev.
This commit is contained in:
Sijie.Sun 2024-05-10 21:40:50 +08:00 committed by GitHub
parent b1153378c9
commit 72701c9eb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -284,20 +284,21 @@ impl Instance {
self.listener_manager.lock().await.run().await?;
self.peer_manager.run().await?;
self.run_rpc_server()?;
self.ip_proxy = Some(IpProxy::new(
self.get_global_ctx(),
self.get_peer_manager(),
)?);
self.ip_proxy.as_ref().unwrap().start().await?;
if let Some(ipv4_addr) = self.global_ctx.get_ipv4() {
self.prepare_tun_device().await?;
self.assign_ipv4_to_tun_device(ipv4_addr).await?;
self.run_proxy_cidrs_route_updater();
}
self.run_rpc_server()?;
// run after tun device created, so listener can bind to tun device, which may be required by win 10
self.ip_proxy = Some(IpProxy::new(
self.get_global_ctx(),
self.get_peer_manager(),
)?);
self.ip_proxy.as_ref().unwrap().start().await?;
self.udp_hole_puncher.lock().await.run().await?;
self.peer_center.init().await;