rollback some parameters

This commit is contained in:
sijie.sun 2024-09-29 21:04:23 +08:00 committed by Sijie.Sun
parent a0ece6ad4d
commit c7895963e4
4 changed files with 8 additions and 8 deletions

View File

@ -438,12 +438,12 @@ impl UdpHolePunchRpc for UdpHolePunchRpcService {
} }
// send max k1 packets if we are predicting the dst port // send max k1 packets if we are predicting the dst port
let max_k1 = 60; let max_k1 = 180;
// send max k2 packets if we are sending to random port // send max k2 packets if we are sending to random port
let max_k2 = rand::thread_rng().gen_range(600..800); let max_k2 = rand::thread_rng().gen_range(600..800);
// this means the NAT is allocating port in a predictable way // this means the NAT is allocating port in a predictable way
if max_port.abs_diff(min_port) <= 3 * max_k1 && round <= 6 && punch_predictablely { if max_port.abs_diff(min_port) <= max_k1 && round <= 6 && punch_predictablely {
let (min_port, max_port) = { let (min_port, max_port) = {
// round begin from 0. if round is even, we guess port in increasing order // round begin from 0. if round is even, we guess port in increasing order
let port_delta = (max_k1 as u32) / ip_count as u32; let port_delta = (max_k1 as u32) / ip_count as u32;
@ -879,7 +879,7 @@ impl UdpHolePunchConnector {
let mut last_port_idx = rand::thread_rng().gen_range(0..data.shuffled_port_vec.len()); let mut last_port_idx = rand::thread_rng().gen_range(0..data.shuffled_port_vec.len());
for round in 0..5 { for round in 0..30 {
let ret = rpc_stub let ret = rpc_stub
.try_punch_symmetric( .try_punch_symmetric(
BaseController {}, BaseController {},

View File

@ -182,7 +182,7 @@ impl UdpNatEntry {
&mut buf, &mut buf,
&src_v4, &src_v4,
len, len,
1256, 1200,
ip_id, ip_id,
) )
.await .await
@ -350,7 +350,7 @@ impl UdpProxy {
peer_manager: Arc<PeerManager>, peer_manager: Arc<PeerManager>,
) -> Result<Arc<Self>, Error> { ) -> Result<Arc<Self>, Error> {
let cidr_set = CidrSet::new(global_ctx.clone()); let cidr_set = CidrSet::new(global_ctx.clone());
let (sender, receiver) = channel(64); let (sender, receiver) = channel(1024);
let ret = Self { let ret = Self {
global_ctx, global_ctx,
peer_manager, peer_manager,

View File

@ -26,7 +26,7 @@ use super::{
StreamItem, Tunnel, TunnelConnector, TunnelError, TunnelInfo, TunnelListener, StreamItem, Tunnel, TunnelConnector, TunnelError, TunnelInfo, TunnelListener,
}; };
static RING_TUNNEL_CAP: usize = 64; static RING_TUNNEL_CAP: usize = 128;
static RING_TUNNEL_RESERVERD_CAP: usize = 4; static RING_TUNNEL_RESERVERD_CAP: usize = 4;
type RingLock = parking_lot::Mutex<()>; type RingLock = parking_lot::Mutex<()>;

View File

@ -293,8 +293,8 @@ impl UdpTunnelListenerData {
return; return;
} }
let ring_for_send_udp = Arc::new(RingTunnel::new(32)); let ring_for_send_udp = Arc::new(RingTunnel::new(64));
let ring_for_recv_udp = Arc::new(RingTunnel::new(32)); let ring_for_recv_udp = Arc::new(RingTunnel::new(64));
tracing::debug!( tracing::debug!(
?ring_for_send_udp, ?ring_for_send_udp,
?ring_for_recv_udp, ?ring_for_recv_udp,