修复代理icmp异常

This commit is contained in:
lubeilin
2023-07-26 21:30:19 +08:00
parent 2c9abf314a
commit d937f392d3
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
use std::collections::HashSet;
use std::io;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use std::sync::Arc;
@@ -183,7 +184,7 @@ impl VntUtil {
// NAT检测
let nat_test = NatTest::new(config.nat_test_server.clone(), response.public_ip, response.public_port, local_ip, local_port);
let out_ips = config.out_ips.iter().map(|(_, _, ip)| *ip).collect::<Vec<Ipv4Addr>>();
let out_ips = config.out_ips.iter().map(|(_, _, ip)| *ip).collect::<HashSet<Ipv4Addr>>();
let out_external_route = ExternalRoute::new(config.out_ips);
let in_external_route = if config.in_ips.is_empty() {
None
+2 -2
View File
@@ -1,5 +1,5 @@
use std::{io, thread};
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use std::net::{Ipv4Addr, SocketAddrV4};
use std::sync::Arc;
use crossbeam_utils::atomic::AtomicCell;
@@ -45,7 +45,7 @@ impl IpProxyMap {
}
}
pub async fn init_proxy(sender: ChannelSender, bind_ips: Vec<Ipv4Addr>, current_device: Arc<AtomicCell<CurrentDeviceInfo>>) -> io::Result<(TcpProxy, UdpProxy, IpProxyMap)> {
pub async fn init_proxy(sender: ChannelSender, bind_ips: HashSet<Ipv4Addr>, current_device: Arc<AtomicCell<CurrentDeviceInfo>>) -> io::Result<(TcpProxy, UdpProxy, IpProxyMap)> {
let mut icmp_sockets = HashMap::new();
let tcp_proxy_map: Arc<SkipMap<SocketAddrV4, (SocketAddrV4, SocketAddrV4)>> = Arc::new(SkipMap::new());
let udp_proxy_map: Arc<SkipMap<SocketAddrV4, (SocketAddrV4, SocketAddrV4)>> = Arc::new(SkipMap::new());