mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #1843] Feature request: limit ports in clients for connecting to server or other clients for xtcp #1453
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#1453
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 @yuliu on GitHub (Jun 5, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1843
It'd be great to see UPnP is implemented as suggested in #1823 for xtcp.
Besides UPnP, there are two other features that are usually left behind in soho routers: port forwarding and port triggering. They're used for exposing certain ports of private hosts to another network separated by a NAT, eg. for FTP, IRC, etc.
If a frp client can use only allowed ports to connect to frp server or other frp clients, then at least these ports can be configured to be exposed to outer networks if we have permissions to set port forwarding or port triggering in our own router.
An example for IRC authentication using port triggering is here https://en.wikipedia.org/wiki/Port_triggering#Example
@fatedier commented on GitHub (Jun 5, 2020):
Can you write a more detailed design?
@yuliu commented on GitHub (Jun 5, 2020):
Well, I haven't read frp's code and don't know how frp clients communicate with frp servers or other frp clients. So, my idea would base on my imaginary understanding about xtcp and an understanding about port forwarding & port triggering that might be wrong.
port forwarding
Alright, here comes the idea. If we can configure the router with port forwarding for our frp clients, we may set it as follows:
Then, if the router's WAN IP is x.x.x.x, then:
52201and52301-52310can be accessed viax.x.x.x:52201andx.x.x.x:52301-x.x.x.x:52310.52201and52301-52310can be accessed viax.x.x.x:52202andx.x.x.x:52311-x.x.x.x:52320.Here's an example of port forwarding configuration from my router:

port triggering
If we can configure the router with port triggering for our frp clients, we may set it as follows (settings may differ):
Then, if the router's WAN IP is x.x.x.x, then:
52201, it'll trigger the router to open52301-52310to this client so that the client's relevant ports can be accessed viax.x.x.x:52301-x.x.x.x:52310from outer network.52202, it'll trigger the router to open52311-52320to this client so that the client's relevant ports can be accessed viax.x.x.x:52311-x.x.x.x:52320from outer network.Here's an example of port triggering configuration from my router:

Hope I make it right. As long as frp client's opened ports can be restricted and port forwarding/triggering of the router a frp client is behind can be configured to open these ports, this client will hopefully be accessible via the forwarded / triggered port from outside network. Then if at least one client, either the one running a service or the visitor, can be accessed from out of NAT, a P2P link between a service client and a visitor would probably be set up.