[PR #5277] [CLOSED] Add NewVisitorConn operation to server plugin system #5225

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

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/5277
Author: @jareddarkweb
Created: 4/3/2026
Status: Closed

Base: devHead: feature/newvisitorconn-plugin


📝 Commits (3)

  • 8956ced feat: Add NewVisitorConn operation to server plugin system
  • ed1ada2 docs: Document NewVisitorConn plugin operation
  • 3dbcf99 test: Add NewVisitorConn plugin operation tests

📊 Changes

6 files changed (+207 additions, -26 deletions)

View changed files

📝 doc/server_plugin.md (+25 -7)
📝 pkg/plugin/server/manager.go (+51 -12)
📝 pkg/plugin/server/plugin.go (+7 -6)
📝 pkg/plugin/server/types.go (+7 -0)
📝 server/service.go (+20 -1)
📝 test/e2e/v1/plugin/server.go (+97 -0)

📄 Description

Feature

Support NewVisitorConn operation in server plugin callbacks to enable pre-connection logic for STCP/SUDP proxies.

Motivation

Fixes #5273

When using stcp proxies, users may need to trigger pre-connection actions (e.g., Wake-on-LAN) before a visitor connects. Currently, there's no plugin hook for visitor connections.

Changes

  • Add OpNewVisitorConn constant to plugin operations
  • Create NewVisitorConnContent struct for plugin payloads
  • Implement plugin manager handler for NewVisitorConn
  • Integrate plugin callback in RegisterVisitorConn method
  • Add comprehensive e2e tests
  • Update documentation

Testing

  • Code compiles without errors
  • Existing tests pass
  • New e2e tests added

Example Usage

[[httpPlugins]]
name = "wol-manager"
addr = "127.0.0.1:9001"
path = "/handler"
ops = ["NewVisitorConn"]

The plugin will receive notifications when a visitor attempts to connect to an stcp proxy, allowing pre-connection logic like Wake-on-LAN.

Make sure:

  • Base: fatedier/frp / dev branch
  • Compare: jareddarkweb/frp / feature/newvisitorconn-plugin branch

🔄 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/5277 **Author:** [@jareddarkweb](https://github.com/jareddarkweb) **Created:** 4/3/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `feature/newvisitorconn-plugin` --- ### 📝 Commits (3) - [`8956ced`](https://github.com/fatedier/frp/commit/8956ced468d40f66eee740091a6a14bd2fbf3963) feat: Add NewVisitorConn operation to server plugin system - [`ed1ada2`](https://github.com/fatedier/frp/commit/ed1ada206cb8e232c6eaf938fae6c830db728140) docs: Document NewVisitorConn plugin operation - [`3dbcf99`](https://github.com/fatedier/frp/commit/3dbcf9963e5b44be9e472cbaf59046daef50646d) test: Add NewVisitorConn plugin operation tests ### 📊 Changes **6 files changed** (+207 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `doc/server_plugin.md` (+25 -7) 📝 `pkg/plugin/server/manager.go` (+51 -12) 📝 `pkg/plugin/server/plugin.go` (+7 -6) 📝 `pkg/plugin/server/types.go` (+7 -0) 📝 `server/service.go` (+20 -1) 📝 `test/e2e/v1/plugin/server.go` (+97 -0) </details> ### 📄 Description ## Feature Support NewVisitorConn operation in server plugin callbacks to enable pre-connection logic for STCP/SUDP proxies. ## Motivation Fixes #5273 When using stcp proxies, users may need to trigger pre-connection actions (e.g., Wake-on-LAN) before a visitor connects. Currently, there's no plugin hook for visitor connections. ## Changes - Add `OpNewVisitorConn` constant to plugin operations - Create `NewVisitorConnContent` struct for plugin payloads - Implement plugin manager handler for NewVisitorConn - Integrate plugin callback in `RegisterVisitorConn` method - Add comprehensive e2e tests - Update documentation ## Testing - [x] Code compiles without errors - [x] Existing tests pass - [x] New e2e tests added ## Example Usage ```toml [[httpPlugins]] name = "wol-manager" addr = "127.0.0.1:9001" path = "/handler" ops = ["NewVisitorConn"] ``` The plugin will receive notifications when a visitor attempts to connect to an stcp proxy, allowing pre-connection logic like Wake-on-LAN. **Make sure:** - Base: `fatedier/frp` / `dev` branch - Compare: `jareddarkweb/frp` / `feature/newvisitorconn-plugin` branch --- <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:57:03 -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#5225
No description provided.