mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-06 14:50:14 +00:00
Make close_fd_on_drop configurable (#132)
This commit is contained in:
parent
15fe95a2c6
commit
635c7e557f
3 changed files with 31 additions and 2 deletions
|
@ -86,11 +86,19 @@ pub async fn desktop_run_async(args: Args, shutdown_token: tokio_util::sync::Can
|
|||
let mut tun_config = tun2::Configuration::default();
|
||||
tun_config.address(TUN_IPV4).netmask(TUN_NETMASK).mtu(MTU).up();
|
||||
tun_config.destination(TUN_GATEWAY);
|
||||
if let Some(tun_fd) = args.tun_fd {
|
||||
tun_config.raw_fd(tun_fd);
|
||||
#[cfg(unix)]
|
||||
if let Some(fd) = args.tun_fd {
|
||||
tun_config.raw_fd(fd);
|
||||
if let Some(v) = args.close_fd_on_drop {
|
||||
tun_config.close_fd_on_drop(v);
|
||||
};
|
||||
} else if let Some(ref tun) = args.tun {
|
||||
tun_config.tun_name(tun);
|
||||
}
|
||||
#[cfg(windows)]
|
||||
if let Some(ref tun) = args.tun {
|
||||
tun_config.tun_name(tun);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
tun_config.platform_config(|cfg| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue