mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #4602] [Feature Request] Add configurable port range for P2P mode #3635
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#3635
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 @stleon on GitHub (Dec 20, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4602
Describe the feature request
I would like to request a feature that allows explicitly defining a range of ports for P2P mode.
Currently, ports are selected using:
source
This approach may result in conflicts if some ports in this range are already in use. Being able to specify a custom port range would provide more control and prevent such issues.
Why this feature should be added
Proposed Solution
Introduce a configuration option, such as p2pPortRange, where users can specify the allowed range of ports:
If not set, the default behavior remains unchanged (random selection from 1024–65535), ensuring backward compatibility.
Describe alternatives you've considered
No response
Affected area
@xqzr commented on GitHub (Dec 21, 2024):
这么做也许不再需要 UPnP #4112。
frpc 指定范围后,在路由器“端口映射”指定的范围,来获得“全锥 NAT(1)”。
@fatedier commented on GitHub (Dec 23, 2024):
I'm not quite sure what specific issue you're encountering. The code you posted is probing the port number on the peer's side. The exit port of the peer's NAT could be any arbitrary port.
@xqzr commented on GitHub (Dec 23, 2024):
例如 XTCP 类型,在 frpc 增加一个
bindSrcPort字段,并设置值为3478。之后,所有的发包(STUN、数据传输...)都使用
3478作为源端口发送。@stleon commented on GitHub (Dec 29, 2024):
I was specifically referring to the ability to define a port range on the client side (frpc). Allowing this configuration would simplify operations in environments with restricted port access, such as when using Docker
@Mohamezezo commented on GitHub (Jan 4, 2025):
p2pPortRange = "29160-29200"
@github-actions[bot] commented on GitHub (Jan 26, 2025):
Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.