Skip to content

Commit 1bacb15

Browse files
ibigbugCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <[email protected]> Signed-off-by: Yuwei Ba <[email protected]>
1 parent b923b5b commit 1bacb15

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

clash-lib/src/proxy/tun/inbound.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub fn get_runner(
105105
let tun_name =
106106
tun_init_config.tun_name.expect("tun name must be provided");
107107
let tun_exist = network_interface::NetworkInterface::show()
108-
.and_then(|ifs| Ok(ifs.into_iter().any(|x| x.name == tun_name)))
108+
.map(|ifs| ifs.into_iter().any(|x| x.name == tun_name))
109109
.unwrap_or_default();
110110

111111
if tun_exist {
@@ -128,12 +128,12 @@ pub fn get_runner(
128128
);
129129
}
130130

131-
if let Some(gateway_v6) = cfg.gateway_v6
132-
&& !tun_exist
133-
{
134-
debug!("setting tun ipv6 addr: {:?}", cfg.gateway_v6);
135-
tun_builder =
136-
tun_builder.ipv6(gateway_v6.addr(), gateway_v6.netmask());
131+
if !tun_exist {
132+
if let Some(gateway_v6) = cfg.gateway_v6 {
133+
debug!("setting tun ipv6 addr: {:?}", cfg.gateway_v6);
134+
tun_builder =
135+
tun_builder.ipv6(gateway_v6.addr(), gateway_v6.netmask());
136+
}
137137
}
138138

139139
#[cfg(target_os = "windows")]

0 commit comments

Comments
 (0)