mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #1658] 客户端能否增加bind_port参数 #1314
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#1314
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 @wyaode on GitHub (Feb 16, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1658
Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)
(请不要在 issue 评论中出现无意义的 加1,我也是 等内容,将会被直接删除。)
(由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。)
Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
What version of frp are you using (./frpc -v or ./frps -v)?
0.31.2
What operating system and processor architecture are you using (
go env)?Windows
Configures you used:
[common]
server_port = 7001
protocol = kcp
每次启动客户端的时候,对于kcp或者udp协议而言,每次本地绑定的udp端口都会变化
由于防火墙要求严格限制每一条进出规则,建议在客户端增加bind_port参数,默认为0
这样可以设置本地绑定的端口,确保可设置防火墙规则并且通信畅通。
@fatedier commented on GitHub (Feb 17, 2020):
看起来可能是一个使用其他应用也会遇到的问题,可以尝试找一个通用的解决方案,比如利用一个本地代理来转发。
@wyaode commented on GitHub (Feb 17, 2020):
昨天我看了一下代码,对客户端而言直接修改/kcp-go/sess.go中的DialWithOptions函数
把原先的conn, err := net.ListenUDP(network, nil)
那个nil替换成net.UDPAddr{IP: net.ParseIP("0.0.0.0"), Port: BindPort}就行,我自己测试没问题
改成从配置文件读取有点麻烦,当然这个只对kcp协议管用,不排除有人对tcp本地端口也有绑定要求。
@fatedier commented on GitHub (Feb 17, 2020):
恩,你可以自己改代码自己编译用的话挺好。网络方面类似的需求肯定还有很多的,如果都在这个项目里通过各种配置来控制,会让项目本身过于复杂,所以如果能够通过组合工具的方式来解决是最好了,每一个工具都有自己专注的方面。