From bc80d5f6411eedc829e3ebd39c328d9a185d40bd Mon Sep 17 00:00:00 2001 From: lbl8603 <49143209+lbl8603@users.noreply.github.com> Date: Wed, 8 Feb 2023 18:00:14 +0800 Subject: [PATCH] Update punch_handler.rs --- switch/src/handle/punch_handler.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/switch/src/handle/punch_handler.rs b/switch/src/handle/punch_handler.rs index 9dd6902..31ea851 100644 --- a/switch/src/handle/punch_handler.rs +++ b/switch/src/handle/punch_handler.rs @@ -107,6 +107,7 @@ fn handle( // 假设绑定n个端口,通过NAT对外映射出n个 公网ip:公网端口,随机尝试k次的情况下 // 猜中的概率 p = 1-((65535-n)/65535)*((65535-n-1)/(65535-1))*...*((65535-n-k+1)/(65535-k+1)) // n取76,k取600,猜中的概率就超过50%了 + // 前提 自己是锥形网络,否则猜中了也通信不了 let mut send_f = |min_port: u16, max_port: u16, k: usize| -> io::Result<()> { let mut nums: Vec = (min_port..max_port).collect(); nums.push(max_port);