[GH-ISSUE #4159] [Feature Request] xtcp打洞时如果是全锥形(或地址受限锥形)nat和对称形nat使用mode0的方式 #3277

Closed
opened 2026-05-05 14:06:57 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @meiweimuli on GitHub (Apr 15, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4159

Describe the feature request

xtcp打洞时如果一边是全锥型(或地址受限锥形)nat,另一边是对称型nat,从对称型这边直接给全锥型发消息,连接就能创建成功了吧。
现在frp首选的方式还是mode1和mode2的预测端口。

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @meiweimuli on GitHub (Apr 15, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/4159 ### Describe the feature request xtcp打洞时如果一边是全锥型(或地址受限锥形)nat,另一边是对称型nat,从对称型这边直接给全锥型发消息,连接就能创建成功了吧。 现在frp首选的方式还是mode1和mode2的预测端口。 ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [X] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@fatedier commented on GitHub (Apr 15, 2024):

实际上,这并不是非常重要。

你如果阅读了代码,应该能看到我们只区分了 HardNAT 和 EasyNAT,而不是具体的各种类似 全锥型地址受限锥形 等等类型。探测具体的这些类型,并不是一件简单的事情,依赖 STUN server 的实现,有时甚至会让问题变得更复杂。

如果 mode0 能够成功,那么 mode1/mode2 大概率也能够成功(为了 cover 边界情况,会主动把 mode0 再放到尝试策略的最后),我们需要的是 p2p 打洞的成功率,一旦成功,这次策略会被记录,这个链路也可以被持续复用,下次优先尝试,没有额外的成本。所以简化的模型就已经足够。

设计之初,测试过部分 STUN Server,很多并没有完全按照协议来实现,结果并不可靠,并且还依赖响应超时来识别类型,流程多的时候,探测类型耗时也会很长,对用户很不友好。考虑过让用户在自己确认自己 NAT 类型的情况下,主动提供辅助信息来调整策略优先级,但并不是必须,暂时不会增加这个复杂度。且所谓的 全锥形(或地址受限锥形) 的比例应该并不高。

<!-- gh-comment-id:2056422264 --> @fatedier commented on GitHub (Apr 15, 2024): 实际上,这并不是非常重要。 你如果阅读了代码,应该能看到我们只区分了 HardNAT 和 EasyNAT,而不是具体的各种类似 `全锥型`、`地址受限锥形` 等等类型。探测具体的这些类型,并不是一件简单的事情,依赖 STUN server 的实现,有时甚至会让问题变得更复杂。 如果 mode0 能够成功,那么 mode1/mode2 大概率也能够成功(为了 cover 边界情况,会主动把 mode0 再放到尝试策略的最后),我们需要的是 p2p 打洞的成功率,一旦成功,这次策略会被记录,这个链路也可以被持续复用,下次优先尝试,没有额外的成本。所以简化的模型就已经足够。 设计之初,测试过部分 STUN Server,很多并没有完全按照协议来实现,结果并不可靠,并且还依赖响应超时来识别类型,流程多的时候,探测类型耗时也会很长,对用户很不友好。考虑过让用户在自己确认自己 NAT 类型的情况下,主动提供辅助信息来调整策略优先级,但并不是必须,暂时不会增加这个复杂度。且所谓的 全锥形(或地址受限锥形) 的比例应该并不高。
Author
Owner

@meiweimuli commented on GitHub (Apr 15, 2024):

mode2确实已经有超过0.98的成功率了,已经够用了。

<!-- gh-comment-id:2056601588 --> @meiweimuli commented on GitHub (Apr 15, 2024): mode2确实已经有超过0.98的成功率了,已经够用了。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#3277
No description provided.