[PR #3472] [MERGED] stcp, xtcp, sudp: support allow_users and specified server user #4757

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

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/3472
Author: @fatedier
Created: 6/1/2023
Status: Merged
Merged: 6/2/2023
Merged by: @fatedier

Base: devHead: remote-user


📝 Commits (1)

  • d60dd1e stcp, xtcp, sudp: support allow_users and specified server user

📊 Changes

17 files changed (+355 additions, -176 deletions)

View changed files

📝 .gitignore (+1 -0)
📝 Makefile (+15 -0)
hack/download.sh (+63 -0)
📝 hack/run-e2e.sh (+18 -8)
📝 pkg/config/client.go (+1 -1)
📝 pkg/config/proxy.go (+113 -103)
📝 pkg/config/visitor.go (+3 -3)
📝 pkg/msg/msg.go (+3 -2)
📝 pkg/nathole/controller.go (+17 -11)
📝 server/control.go (+4 -4)
📝 server/proxy/stcp.go (+6 -1)
📝 server/proxy/sudp.go (+6 -2)
📝 server/proxy/xtcp.go (+6 -2)
📝 server/service.go (+10 -1)
📝 server/visitor/visitor.go (+27 -16)
📝 test/e2e/basic/basic.go (+61 -21)
📝 test/e2e/framework/process.go (+1 -1)

📄 Description

Summary

🤖 Generated by Copilot at ae8d19f

This pull request adds a new feature to allow proxy owners to specify which users can access their server role proxies as visitors, and improves the end-to-end testing and error handling for this feature. It also adds a script to download the latest frp release and refactors some configuration and message code for consistency and clarity. The main files affected are pkg/config/proxy.go, pkg/nathole/controller.go, server/control.go, server/visitor/visitor.go, test/e2e/basic/basic.go, hack/download.sh, pkg/msg/msg.go, and the proxy files in server/proxy.

WHY

Walkthrough

🤖 Generated by Copilot at ae8d19f

  • Add a new script to download the latest frp release from GitHub (link)
  • Add two new fields to the NewProxy message to support server role proxies and the allow_users feature (link)
  • Add a new field to the ClientCfg struct to store the list of users that are allowed to access the proxy as visitors (link)
  • Modify the NatHoleController to accept and check the allowUsers and visitorUser parameters for xtcp proxies (link, link)
  • Modify the Control struct to pass the visitor user name to the NatHoleController and improve the error messages for proxy registration (link, link, link)
  • Modify the Service struct to get the visitor user name from the control manager and pass it to the VisitorManager (link)
  • Modify the VisitorManager to use a new type listenerBundle to wrap the listener, sk, and allowUsers fields together, and check the visitor user's permission before accepting the connection (link, link, link, link, link, link)
  • Modify the STCPProxy, SUDPProxy, and XTCPProxy structs to accept the allowUsers parameter and pass it to the VisitorManager or the NatHoleController (link, link, link)
  • Modify the proxy config package to add methods to marshal and unmarshal the common fields for server role proxies, improve the error messages for configuration parsing, and rename some parameters for consistency (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Modify the run-e2e.sh script to use /bin/sh instead of /usr/bin/env bash, and allow setting the FRPC_PATH and FRPS_PATH variables to use custom binaries for frpc and frps (link, link)
  • Add new targets to the Makefile for running end-to-end tests with the last released version of frpc or frps, and remove the lastversion directory after running the e2e-compatibility target (link, link)
  • Modify the basic package to add new fields and parameters to support the allow_users feature for server role proxies, and use a shorter timeout and the keep_tunnel_open option for xtcp proxies to reduce the testing time (link, link, link, link, link)

🔄 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/3472 **Author:** [@fatedier](https://github.com/fatedier) **Created:** 6/1/2023 **Status:** ✅ Merged **Merged:** 6/2/2023 **Merged by:** [@fatedier](https://github.com/fatedier) **Base:** `dev` ← **Head:** `remote-user` --- ### 📝 Commits (1) - [`d60dd1e`](https://github.com/fatedier/frp/commit/d60dd1ef4223d191136fb61ff33ba442dfddd12c) stcp, xtcp, sudp: support allow_users and specified server user ### 📊 Changes **17 files changed** (+355 additions, -176 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) 📝 `Makefile` (+15 -0) ➕ `hack/download.sh` (+63 -0) 📝 `hack/run-e2e.sh` (+18 -8) 📝 `pkg/config/client.go` (+1 -1) 📝 `pkg/config/proxy.go` (+113 -103) 📝 `pkg/config/visitor.go` (+3 -3) 📝 `pkg/msg/msg.go` (+3 -2) 📝 `pkg/nathole/controller.go` (+17 -11) 📝 `server/control.go` (+4 -4) 📝 `server/proxy/stcp.go` (+6 -1) 📝 `server/proxy/sudp.go` (+6 -2) 📝 `server/proxy/xtcp.go` (+6 -2) 📝 `server/service.go` (+10 -1) 📝 `server/visitor/visitor.go` (+27 -16) 📝 `test/e2e/basic/basic.go` (+61 -21) 📝 `test/e2e/framework/process.go` (+1 -1) </details> ### 📄 Description ### Summary <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at ae8d19f</samp> This pull request adds a new feature to allow proxy owners to specify which users can access their server role proxies as visitors, and improves the end-to-end testing and error handling for this feature. It also adds a script to download the latest frp release and refactors some configuration and message code for consistency and clarity. The main files affected are `pkg/config/proxy.go`, `pkg/nathole/controller.go`, `server/control.go`, `server/visitor/visitor.go`, `test/e2e/basic/basic.go`, `hack/download.sh`, `pkg/msg/msg.go`, and the proxy files in `server/proxy`. ### WHY <!-- author to complete --> ### Walkthrough <!-- copilot:walkthrough --> ### <samp>🤖 Generated by Copilot at ae8d19f</samp> * Add a new script to download the latest frp release from GitHub ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-73a177e4add069fec5e561eb32ef0e2a3f990f9cc1f5f95f23a199c046eaf20bR1-R63)) * Add two new fields to the NewProxy message to support server role proxies and the allow_users feature ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-d06db243b3da859f1e0ad2aa35dcdb7d050f1d401faad8668be9ff336165b628L113-R115)) * Add a new field to the ClientCfg struct to store the list of users that are allowed to access the proxy as visitors ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-2f15ef36bc925196e99eb8971b235db30a64a9c44c6ac37215abdaaac812777fL46-R49)) * Modify the `NatHoleController` to accept and check the allowUsers and visitorUser parameters for xtcp proxies ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-2f15ef36bc925196e99eb8971b235db30a64a9c44c6ac37215abdaaac812777fL123-R129), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-2f15ef36bc925196e99eb8971b235db30a64a9c44c6ac37215abdaaac812777fL147-R160)) * Modify the `Control` struct to pass the visitor user name to the `NatHoleController` and improve the error messages for proxy registration ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-292ec4fee0964ed74268d2a5345341096a228f932403bbb4acd1d3e94405d891L527-R527), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-292ec4fee0964ed74268d2a5345341096a228f932403bbb4acd1d3e94405d891L540-R540), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-292ec4fee0964ed74268d2a5345341096a228f932403bbb4acd1d3e94405d891L553-R554)) * Modify the `Service` struct to get the visitor user name from the control manager and pass it to the `VisitorManager` ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-7cd1def768b5bcc52b79dd84b45271a4f4c0604d574564e6b60e8f2770691394L590-R600)) * Modify the `VisitorManager` to use a new type `listenerBundle` to wrap the listener, sk, and allowUsers fields together, and check the visitor user's permission before accepting the connection ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-d5981c6c125eed9ee4794317408ee0883c2bd8744dbbd01634c362e54a97a50fR24), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-d5981c6c125eed9ee4794317408ee0883c2bd8744dbbd01634c362e54a97a50fL29-R38), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-d5981c6c125eed9ee4794317408ee0883c2bd8744dbbd01634c362e54a97a50fL39-R53), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-d5981c6c125eed9ee4794317408ee0883c2bd8744dbbd01634c362e54a97a50fL54-R86), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-d5981c6c125eed9ee4794317408ee0883c2bd8744dbbd01634c362e54a97a50fL82-R94), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-d5981c6c125eed9ee4794317408ee0883c2bd8744dbbd01634c362e54a97a50fL94-R106)) * Modify the `STCPProxy`, `SUDPProxy`, and `XTCPProxy` structs to accept the allowUsers parameter and pass it to the `VisitorManager` or the `NatHoleController` ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-a8a3608f703647da704896989ae588d6b548f5cb25859adb54a2f1fe8f33b4d1L30-R35), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-27e265b12a950d00fe661898c5422ce6a3c99d7b928c44443c293737439122bbL30-R35), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-52f5ffea2008402b178846549fb887fd3961403113f5a846202923dc48936b1cL38-R46)) * Modify the proxy config package to add methods to marshal and unmarshal the common fields for server role proxies, improve the error messages for configuration parsing, and rename some parameters for consistency ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-fd40de974f57bca0b0360aa388aae106227b36be701f6c5fedbd511a6f39a062L355-R355), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eR181-R190), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL263-R273), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL277-R297), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL344-R382), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL485-R499), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL503-R517), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL539-R570), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL613-R634), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL656-R691), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL725-R748), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL787-R808), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL841-R862), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-583ded603117becc13d8e964684141cebdb4256ecc9a87f7dce32af788aa039eL895-R916), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-6ee1be2917f26b793160747c763b3b1600cee8faf4985e9147810f2e085428ebL97-R106)) * Modify the `run-e2e.sh` script to use /bin/sh instead of /usr/bin/env bash, and allow setting the FRPC_PATH and FRPS_PATH variables to use custom binaries for frpc and frps ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-0913e7b61c925dbdbf31c36ad24131da81c64f8ec9c3477662eec4cca73dba07L1-R1), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-0913e7b61c925dbdbf31c36ad24131da81c64f8ec9c3477662eec4cca73dba07L16-R29)) * Add new targets to the Makefile for running end-to-end tests with the last released version of frpc or frps, and remove the lastversion directory after running the e2e-compatibility target ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R49-R62), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R68)) * Modify the basic package to add new fields and parameters to support the allow_users feature for server role proxies, and use a shorter timeout and the keep_tunnel_open option for xtcp proxies to reduce the testing time ([link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-198c426913c63e51585ac1793ca15e8e195cf8a0a72ba93e9b12d2f6acd9fa44L285-R287), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-198c426913c63e51585ac1793ca15e8e195cf8a0a72ba93e9b12d2f6acd9fa44L315-R316), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-198c426913c63e51585ac1793ca15e8e195cf8a0a72ba93e9b12d2f6acd9fa44L323-R339), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-198c426913c63e51585ac1793ca15e8e195cf8a0a72ba93e9b12d2f6acd9fa44L338-R356), [link](https://github.com/fatedier/frp/pull/3472/files?diff=unified&w=0#diff-198c426913c63e51585ac1793ca15e8e195cf8a0a72ba93e9b12d2f6acd9fa44L353-R362)) --- <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:48:08 -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#4757
No description provided.