fmt
This commit is contained in:
+11
-12
@@ -268,16 +268,15 @@ impl Punch {
|
|||||||
}
|
}
|
||||||
let device_info = self.current_device.load();
|
let device_info = self.current_device.load();
|
||||||
|
|
||||||
nat_info.public_ips.retain(|ip| {
|
nat_info
|
||||||
is_ipv4_global(ip)
|
.public_ips
|
||||||
&& device_info.not_in_network(*ip)
|
.retain(|ip| is_ipv4_global(ip) && device_info.not_in_network(*ip));
|
||||||
});
|
|
||||||
nat_info.public_ports.retain(|port| *port != 0);
|
nat_info.public_ports.retain(|port| *port != 0);
|
||||||
nat_info.udp_ports.retain(|port| *port != 0);
|
nat_info.udp_ports.retain(|port| *port != 0);
|
||||||
|
|
||||||
nat_info.local_ipv4 = nat_info.local_ipv4.filter(|ip| {
|
nat_info.local_ipv4 = nat_info
|
||||||
device_info.not_in_network(*ip)
|
.local_ipv4
|
||||||
});
|
.filter(|ip| device_info.not_in_network(*ip));
|
||||||
|
|
||||||
if punch_tcp && self.punch_model.use_tcp() && nat_info.tcp_port != 0 {
|
if punch_tcp && self.punch_model.use_tcp() && nat_info.tcp_port != 0 {
|
||||||
//向tcp发起连接
|
//向tcp发起连接
|
||||||
@@ -383,11 +382,11 @@ impl Punch {
|
|||||||
}
|
}
|
||||||
let mut index = start
|
let mut index = start
|
||||||
+ self.punch_symmetric(
|
+ self.punch_symmetric(
|
||||||
&self.port_vec[start..end],
|
&self.port_vec[start..end],
|
||||||
buf,
|
buf,
|
||||||
&nat_info.public_ips,
|
&nat_info.public_ips,
|
||||||
max_k2,
|
max_k2,
|
||||||
)?;
|
)?;
|
||||||
if index >= self.port_vec.len() {
|
if index >= self.port_vec.len() {
|
||||||
index = 0
|
index = 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user