mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #1585] 优化XTCP穿透性能的代码修改 #1257
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#1257
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @leveljiujiu on GitHub (Dec 29, 2019).
Original GitHub issue: https://github.com/fatedier/frp/issues/1585
由于 Symmetric NAT 每次会话都会使用新端口,目前当 visitor 是 Symmetric 时,无法穿透成功,做以下修改后,client 为 Full Cone 和 Restricted Cone 的情况下,Symmetric 的 visitor 都能穿透成功,且不会影响原有功能:
“client/proxy/proxy.go” 文件 352行:
kcpConn, err := frpNet.NewKcpConnFromUdp(lConn, false, natHoleRespMsg.VisitorAddr)
修改为:
kcpConn, err := frpNet.NewKcpConnFromUdp(lConn, false, uAddr.String())
@fatedier commented on GitHub (Dec 30, 2019):
好像是这样的,如果能够收到包,直接用 uAddr 的地址就可以了。你可以直接提一个 PR 到 dev 分支来修改这个问题。
Full Cone 和 Restricted Cone 和情况应该比较少。你对这方面有研究的话,可以尝试改进一下这部分的代码, 目前只是一个很简单的版本。之前看了一篇 Symmetric NAT 的穿透的方法,感觉可以尝试下,应该能够对穿透率有比较大的提升。
@leveljiujiu commented on GitHub (Dec 30, 2019):
Full Cone 可以通过开启光猫和路由器的DMZ功能实现,Symmetric 主要出现在手机网络,Symmetric 能和 Full Cone 进行p2p,就已经满足了在外随时随地连接家庭网络的应用场景。
个人觉得,目前frp作为生产环境,p2p的速度和稳定性都比较高了,而Symmetric NAT 的穿透一般都是进行端口预测,是能概率性的提高穿透效果,不过作为生产环境存在可靠性不高的问题,尤其是在高并发的时候。
另外我对git的操作很是陌生,这段代码就有劳你修改一下了。