Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for setting custom udp listen port on the xtcp mode #4681

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

zjay1987
Copy link

@zjay1987 zjay1987 commented Feb 20, 2025

Enhancing xtcp Connectivity with UDP Port Forwarding

If the home router’s NAT traversal (hole punching) doesn’t work well—such as when it operates in Symmetric NAT mode only—an explicit UDP port forwarding rule can be configured on the router to make the NAT on the configured port deterministic. For example:

Router Configuration

UDP 9999 → {Your-LAN-IP}:9999

frpc Configuration

[[visitors]]
name = "..."
type = "xtcp"
serverName = "..."
secretKey = "..."
bindAddr = "..."
bindPort = "..."
udpListen = "0.0.0.0:9999"

With this setup, frpc will use UDP port 9999 for communication with the STUN server instead of selecting a random port. Since port 9999 on the router is already configured to forwarded all traffics to {Your-LAN-IP}:9999, if there's no other Symmetric NAT above the router, a successful xtcp connection will be established.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant