Skip to content

Add NewVisitorConn operation to server plugin system#5277

Open
jareddarkweb wants to merge 3 commits intofatedier:devfrom
jareddarkweb:feature/newvisitorconn-plugin
Open

Add NewVisitorConn operation to server plugin system#5277
jareddarkweb wants to merge 3 commits intofatedier:devfrom
jareddarkweb:feature/newvisitorconn-plugin

Conversation

@jareddarkweb
Copy link
Copy Markdown

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

jareddarkweb added 3 commits April 3, 2026 15:09
- Add OpNewVisitorConn constant to support visitor connection callbacks
- Add NewVisitorConnContent struct for plugin payload
- Implement plugin manager handler for visitor connections
- Integrate plugin hook in RegisterVisitorConn method

Closes fatedier#5273
RunID: newMsg.RunID,
},
ProxyName: newMsg.ProxyName,
ProxyType: "stcp", // Default type, could be determined from proxy config
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: ProxyType is hard-coded to "stcp", so sudp visitor connections will be reported to plugins as the wrong protocol. Any plugin that branches on proxy_type will mis-handle or reject every sudp connection even though this hook is documented for both visitor-based proxy types.

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot bot commented Apr 3, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
server/service.go 706 ProxyType is hard-coded to stcp, so plugins cannot distinguish sudp visitor connections correctly.
Other Observations (not in diff)

No additional issues found outside the diff.

Files Reviewed (6 files)
  • doc/server_plugin.md - 0 issues
  • pkg/plugin/server/manager.go - 0 issues
  • pkg/plugin/server/plugin.go - 0 issues
  • pkg/plugin/server/types.go - 0 issues
  • server/service.go - 1 issue
  • test/e2e/v1/plugin/server.go - 0 issues

Fix these issues in Kilo Cloud


Reviewed by gpt-5.4-20260305 · 227,761 tokens

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.

[Feature Request] Support NewVisitorConn operation in server plugin callbacks

1 participant