Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vnt-dev committed Jul 31, 2024
1 parent ace0268 commit be8d4cb
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions vnt/src/channel/punch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,15 @@ impl Punch {
}
let device_info = self.current_device.load();

nat_info.public_ips.retain(|ip| {
is_ipv4_global(ip)
&& device_info.not_in_network(*ip)
});
nat_info
.public_ips
.retain(|ip| is_ipv4_global(ip) && device_info.not_in_network(*ip));
nat_info.public_ports.retain(|port| *port != 0);
nat_info.udp_ports.retain(|port| *port != 0);

nat_info.local_ipv4 = nat_info.local_ipv4.filter(|ip| {
device_info.not_in_network(*ip)
});
nat_info.local_ipv4 = nat_info
.local_ipv4
.filter(|ip| device_info.not_in_network(*ip));

if punch_tcp && self.punch_model.use_tcp() && nat_info.tcp_port != 0 {
//向tcp发起连接
Expand Down Expand Up @@ -383,11 +382,11 @@ impl Punch {
}
let mut index = start
+ self.punch_symmetric(
&self.port_vec[start..end],
buf,
&nat_info.public_ips,
max_k2,
)?;
&self.port_vec[start..end],
buf,
&nat_info.public_ips,
max_k2,
)?;
if index >= self.port_vec.len() {
index = 0
}
Expand Down

0 comments on commit be8d4cb

Please sign in to comment.