[PR #4681] [CLOSED] feat: add support for setting custom udp listen port on the xtcp mode #5026

Closed
opened 2026-05-05 14:53:18 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/4681
Author: @zjay1987
Created: 2/20/2025
Status: Closed

Base: devHead: dev


📝 Commits (1)

  • 5b32150 feat: add support for setting custom udp listen port on the xtcp mode

📊 Changes

4 files changed (+9 additions, -4 deletions)

View changed files

📝 client/proxy/xtcp.go (+1 -1)
📝 client/visitor/xtcp.go (+1 -1)
📝 pkg/config/v1/visitor.go (+5 -0)
📝 pkg/nathole/nathole.go (+2 -2)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fatedier/frp/pull/4681 **Author:** [@zjay1987](https://github.com/zjay1987) **Created:** 2/20/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `dev` --- ### 📝 Commits (1) - [`5b32150`](https://github.com/fatedier/frp/commit/5b3215018892350bc71e74b9bffb1cf1222f34d6) feat: add support for setting custom udp listen port on the xtcp mode ### 📊 Changes **4 files changed** (+9 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `client/proxy/xtcp.go` (+1 -1) 📝 `client/visitor/xtcp.go` (+1 -1) 📝 `pkg/config/v1/visitor.go` (+5 -0) 📝 `pkg/nathole/nathole.go` (+2 -2) </details> ### 📄 Description ### **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** ```toml [[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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 14:53:18 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#5026
No description provided.